chg: If no object ID is set in the URL for adding an object reference, check the payload for the object_uuid

pull/2517/head
iglocska 2017-09-27 14:56:21 +02:00
parent b658c20b75
commit 616fc0f9a2
1 changed files with 9 additions and 1 deletions

View File

@ -13,7 +13,15 @@ class ObjectReferencesController extends AppController {
),
);
public function add($objectId) {
public function add($objectId = false) {
if (empty($objectId)) {
if ($this->request->is('post') && !empty($this->request->data['object_uuid'])) {
$objectId = $this->request->data['object_uuid'];
}
}
if (empty($objectId)) {
throw new MethodNotAllowedException('No object defined.');
}
if (Validation::uuid($objectId)) {
$temp = $this->ObjectReference->Object->find('first', array(
'recursive' => -1,