Example #1
0
 /**
  * After find callback
  *
  * @param mixed $results The results of the find operation
  * @param boolean $primary Whether this model is being queried directly (vs. being queried as an association)
  * @return mixed Result of the find operation
  */
 function afterFind(Model $Model, $results, $primary = false)
 {
     if (!empty($results)) {
         foreach ($results as $key => $result) {
             $results[$key] = $Model->deserialize($result);
         }
     }
     return $results;
 }
 /**
  * Called after each save operation
  *
  * @param Model $Model
  * @param bool $created
  * @param array $options
  * @return void
  */
 public function afterSave(Model $Model, $created, $options = array())
 {
     if (!empty($options['deserialize'])) {
         $Model->data = $Model->deserialize($Model->data);
     }
 }