Skip to content

Commit dabe3a2

Browse files
committed
feat: Reduce noise when dumping entities
The `$model` property is huge, reduce so dump output is more readable
1 parent d5f8880 commit dabe3a2

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/Common/Resource/Entity.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,24 @@ public function getModel(): ?Base
5151
{
5252
return $this->model;
5353
}
54+
55+
// --------------------------------------------------------------------------
56+
57+
/**
58+
* Custom debug info to prevent deep recursion when dumping the model property
59+
*/
60+
public function __debugInfo(): array
61+
{
62+
$info = get_object_vars($this);
63+
64+
// If model is set, replace the object with its class name
65+
if (isset($this->model)) {
66+
$info['model'] = sprintf(
67+
'%s Object ()',
68+
get_class($this->model)
69+
);
70+
}
71+
72+
return $info;
73+
}
5474
}

0 commit comments

Comments
 (0)