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
/** | |
* Add Method. | |
* | |
* @return \Cake\Controller\Controller::redirect | |
*/ | |
public function add() | |
{ | |
$table = TableRegistry::get($this->modelClass); | |
$data = $table->newEntity(); | |
$name = Inflector::singularize($this->modelClass); |
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
/** | |
* Build Validator Method. | |
* | |
* @param Validator $validator | |
* | |
* @return Validator $validator | |
*/ | |
protected function _buildValidator(Validator $validator) | |
{ | |
return $validator |
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
/** | |
* Get Color Accessor Method | |
* | |
* @param string $color | |
* | |
* @return string | |
*/ | |
protected function getColor($color) | |
{ | |
return '#' . $color; |
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
$routes->resources('Feeds', [ | |
'only' => ['add', 'delete'], | |
]); | |
$routes->resources('GoogleFeeds', [ | |
'only' => ['add', 'delete'], | |
]); |
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', |
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
/src/Controller/Api/FeedsController.php (line 31) | |
object(App\Model\Entity\Calendar) { | |
'id' => (int) 1, | |
'title' => 'TEST 1', | |
'calendar_event_count' => (int) 0, | |
'is_visible' => true, | |
'api_key_id' => (int) 1, | |
'color' => null, | |
'created' => null, |
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
object(App\Model\Entity\Calendar) { | |
'id' => (int) 1, | |
'title' => 'TEST 1', | |
'calendar_event_count' => (int) 0, | |
'is_visible' => true, | |
'api_key_id' => (int) 1, | |
'color' => null, | |
'created' => null, | |
'modified' => object(Cake\I18n\FrozenTime) { |
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
$data['feeds']['_ids'] = $this->request->data['feeds']; | |
$calendars = TableRegistry::get('Calendars'); | |
$calendar = $calendars->get($this->request->data['id'], [ | |
'associated' => [ | |
'Feeds', | |
], | |
]); | |
$calendar = $calendars->patchEntity($calendar, $data); | |
if ($calendars->save($calendar, ['associated' => ['Feeds']])) { | |
echo 'yes'; |
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
$data['feeds']['_ids'] = $this->request->data['feeds']; | |
$calendars = TableRegistry::get('Calendars'); | |
$calendar = $calendars->newEntity($data, [ | |
'associated' => [ | |
'Feeds', | |
], | |
]); | |
debug($calendar); | |
$calendars->save($calendar); |
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
<?php | |
namespace App\Model\Table; | |
use App\Model\Entity\Calendar; | |
use Cake\ORM\Query; | |
use Cake\ORM\RulesChecker; | |
use Cake\ORM\Table; | |
use Cake\Validation\Validator; | |
/** |
NewerOlder