chg: [APIRearrange] component tied into rest response
parent
3e0d015f69
commit
d96353ee4f
|
@ -8,7 +8,7 @@ use Cake\Utility\Inflector;
|
||||||
|
|
||||||
class RestResponseComponent extends Component
|
class RestResponseComponent extends Component
|
||||||
{
|
{
|
||||||
public $components = ['ACL'];
|
public $components = ['ACL', 'APIRearrange'];
|
||||||
|
|
||||||
public $headers = [];
|
public $headers = [];
|
||||||
|
|
||||||
|
@ -558,6 +558,9 @@ class RestResponseComponent extends Component
|
||||||
if (!empty($errors)) {
|
if (!empty($errors)) {
|
||||||
$data['errors'] = $errors;
|
$data['errors'] = $errors;
|
||||||
}
|
}
|
||||||
|
if (!$raw) {
|
||||||
|
$data = $this->APIRearrange->rearrange($data);
|
||||||
|
}
|
||||||
return $this->__sendResponse($data, 200, $format, $raw, $download, $headers);
|
return $this->__sendResponse($data, 200, $format, $raw, $download, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,6 @@ class MetaFieldsBehavior extends Behavior
|
||||||
$property = $this->getConfig('metaFieldsAssoc.propertyName');
|
$property = $this->getConfig('metaFieldsAssoc.propertyName');
|
||||||
$options['accessibleFields'][$property] = true;
|
$options['accessibleFields'][$property] = true;
|
||||||
$options['associated']['MetaFields']['accessibleFields']['id'] = true;
|
$options['associated']['MetaFields']['accessibleFields']['id'] = true;
|
||||||
|
|
||||||
if (isset($data[$property])) {
|
if (isset($data[$property])) {
|
||||||
if (!empty($data[$property])) {
|
if (!empty($data[$property])) {
|
||||||
$data[$property] = $this->normalizeMetafields($data[$property]);
|
$data[$property] = $this->normalizeMetafields($data[$property]);
|
||||||
|
|
Loading…
Reference in New Issue