Skip to content

Instantly share code, notes, and snippets.

@cpierce
Last active June 3, 2016 05:19
Show Gist options
  • Save cpierce/e854b87013639e21265175814adb5e43 to your computer and use it in GitHub Desktop.
Save cpierce/e854b87013639e21265175814adb5e43 to your computer and use it in GitHub Desktop.
$data['feeds']['_ids'] = $this->request->data['feeds'];
$calendars = TableRegistry::get('Calendars');
$calendar = $calendars->newEntity($data, [
'associated' => [
'Feeds',
],
]);
debug($calendar);
$calendars->save($calendar);
== debug ==
/src/Controller/Api/FeedsController.php (line 31)
object(App\Model\Entity\Calendar) {
'feeds' => [
(int) 0 => object(App\Model\Entity\Calendar) {
'id' => (int) 37,
'title' => 'TEST 2',
'calendar_event_count' => null,
'is_visible' => true,
'api_key_id' => (int) 1,
'color' => null,
'created' => null,
'modified' => null,
'[new]' => false,
'[accessible]' => [
'*' => true
],
'[dirty]' => [],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Feeds'
},
(int) 1 => object(App\Model\Entity\Calendar) {
'id' => (int) 127,
'title' => 'TEST 3',
'calendar_event_count' => null,
'is_visible' => true,
'api_key_id' => (int) 1,
'color' => null,
'created' => null,
'modified' => null,
'[new]' => false,
'[accessible]' => [
'*' => true
],
'[dirty]' => [],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Feeds'
}
],
'[new]' => true,
'[accessible]' => [
'*' => true
],
'[dirty]' => [
'feeds' => true
],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [
'title' => [
'_required' => 'A title is required.'
]
],
'[invalid]' => [],
'[repository]' => 'Calendars'
}
===debug===
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment