Skip to main content

Posts

Showing posts from September, 2014

Save multiple rows record in cakephp

You can also use this format to save several records and their HABTM associations with  saveAll() , using an array like the following: Array ( [0] => Array ( [Note] => Array ( [id] => 0 [company_id] => 53218f2c-91f8-4168-a1d6-09b50a28b132 [cid] => 53199bf6-2e78-43c2-8a08-084f0a28b132 [author] => vh admin [notedate] => 2014-09-05 [time] => 16:08:46 [type] => client [type_id] => 53199bf6-2e78-43c2-8a08-084f0a28b132 [subject] => Inactivated [reason] => Feedback issues [message] => Views are the presentation layer in CakePHP. They convert the data fetched from Models into the output format requested by the client. Read more about ) ) [1] => Array ...

Softdelete behaviors in cakephp

<?php class SoftDeleteBehavior extends ModelBehavior { /**  * Default settings  *  * @var array $default  */ public $default = array('deleted' => 'deleted_date'); /**  * Holds activity flags for models  *  * @var array $runtime  */ public $runtime = array(); /**  * Setup callback  *  * @param object $model  * @param array $settings  */     public function setup(&$model, $settings = array()) {         if (empty($settings)) {             $settings = $this->default;         } elseif (!is_array($settings)) {             $settings = array($settings);         }         $error = 'SoftDeleteBehavior::setup(): model ' . $model->alias . ' has no field ';         $fields = $this->_normalizeFields($model, $settings)...