diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index 441a5e7..f2683a2 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -432,9 +432,9 @@ class CRUDComponent extends Component if ($metaFieldsEnabled) { $metaTemplates = $this->getMetaTemplates(); $data = $this->attachMetaTemplatesIfNeeded($data, $metaTemplates->toArray()); - if (isset($params['afterFind'])) { - $data = $params['afterFind']($data, $params); - } + } + if (isset($params['afterFind'])) { + $data = $params['afterFind']($data, $params); } if ($this->request->is('post')) { $patchEntityParams = [