chg: Setting the 'Tag' key when editing a tag through API is not mandatory (consistency)

pull/5031/head
Pierre-Jean Grenier 2019-08-20 17:46:44 +02:00
parent 9bef0560fc
commit 851cfb84e4
1 changed files with 3 additions and 0 deletions

View File

@ -289,6 +289,9 @@ class TagsController extends AppController
throw new NotFoundException('You don\'t have permission to do that.');
}
if ($this->request->is('post') || $this->request->is('put')) {
if (!isset($this->request->data['Tag'])) {
$this->request->data = array('Tag' => $this->request->data);
}
$this->request->data['Tag']['id'] = $id;
if ($this->Tag->save($this->request->data)) {
if ($this->_isRest()) {