Skip to content

Commit f9f615c

Browse files
committed
Merge pull request #334 from cakephp/issue-forms
Handle form instances specifically.
2 parents e32cdd0 + a05d32e commit f9f615c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/Panel/VariablesPanel.php

+10
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ public function shutdown(Event $event)
7373
if ($item instanceof Query) {
7474
$item = $item->all();
7575
}
76+
// Handle forms specifically until they implement __debugInfo
77+
if ($item instanceof Form) {
78+
$item = [
79+
'form class' => get_class($item),
80+
'errors' => $item->errors()
81+
];
82+
}
7683
if ($item instanceof Closure ||
7784
$item instanceof PDO ||
7885
$item instanceof SimpleXmlElement
@@ -88,6 +95,9 @@ public function shutdown(Event $event)
8895
$item->getLine()
8996
);
9097
}
98+
if (is_object($item) && method_exists($item, '__debugInfo')) {
99+
$item = $item->__debugInfo();
100+
}
91101
return $item;
92102
});
93103

0 commit comments

Comments
 (0)