chg: [APIRearrange] component tied into rest response

cli-modification-summary
iglocska 2022-08-19 13:02:25 +02:00
parent 3e0d015f69
commit d96353ee4f
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 4 additions and 2 deletions

View File

@ -8,7 +8,7 @@ use Cake\Utility\Inflector;
class RestResponseComponent extends Component
{
public $components = ['ACL'];
public $components = ['ACL', 'APIRearrange'];
public $headers = [];
@ -558,6 +558,9 @@ class RestResponseComponent extends Component
if (!empty($errors)) {
$data['errors'] = $errors;
}
if (!$raw) {
$data = $this->APIRearrange->rearrange($data);
}
return $this->__sendResponse($data, 200, $format, $raw, $download, $headers);
}

View File

@ -111,7 +111,6 @@ class MetaFieldsBehavior extends Behavior
$property = $this->getConfig('metaFieldsAssoc.propertyName');
$options['accessibleFields'][$property] = true;
$options['associated']['MetaFields']['accessibleFields']['id'] = true;
if (isset($data[$property])) {
if (!empty($data[$property])) {
$data[$property] = $this->normalizeMetafields($data[$property]);