chg: [component:CRUD] Include meta-template before calling `afterFind`

refacto/CRUDComponent
Sami Mokaddem 2023-02-24 14:57:40 +01:00
parent 0833a8c0e4
commit fda8aa5866
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 4 additions and 4 deletions

View File

@ -568,16 +568,16 @@ class CRUDComponent extends Component
$query->where($params['conditions']);
}
$data = $query->first();
if ($this->metaFieldsSupported()) {
$metaTemplates = $this->getMetaTemplates();
$data = $this->attachMetaTemplatesIfNeeded($data, $metaTemplates->toArray());
}
if (isset($params['afterFind'])) {
$data = $params['afterFind']($data, $params);
}
if (empty($data)) {
throw new NotFoundException(__('Invalid {0}.', $this->ObjectAlias));
}
if ($this->metaFieldsSupported()) {
$metaTemplates = $this->getMetaTemplates();
$data = $this->attachMetaTemplatesIfNeeded($data, $metaTemplates->toArray());
}
if ($this->request->is(['post', 'put'])) {
$patchEntityParams = [
'associated' => []