Created
June 3, 2016 05:31
-
-
Save cpierce/932722aee20b43b6a759152434ed498f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function add() | |
{ | |
if ( ! $this->request->data) { | |
$this->response->statusCode('400'); | |
} else { | |
$data['feeds']['_ids'] = $this->request->data['feeds']; | |
$calendars = TableRegistry::get('Calendars'); | |
$calendar = $calendars->get($this->request->data['id'], [ | |
'associated' => [ | |
'Feeds', | |
], | |
]); | |
debug($calendar); | |
$calendar = $calendars->patchEntity($calendar, $data); | |
debug($calendar); | |
if ($calendars->save($calendar, ['associated' => ['Feeds']])) { | |
echo 'yes'; | |
} else { | |
echo 'no'; | |
} | |
debug($calendar); | |
die(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment