Пример #1
0
 /**
  * Update the model with the given attributes
  *  
  * @param \GO\Base\Db\ActiveRecord $model
  * @param array $data
  * @return Boolean 
  */
 private function _updateModel($model, $data)
 {
     $changeAttributes = array();
     foreach ($data as $attr => $value) {
         if ($value['edit']) {
             $changeAttributes[$value['name']] = $value['value'];
         }
     }
     $model->setAttributes($changeAttributes);
     return $model->save();
 }
Пример #2
0
 public function setAttributes($attributes, $format = null)
 {
     $publicProperties = $this->_getAdditionalJobProperties();
     $propArray = array();
     foreach ($publicProperties as $property) {
         if (key_exists($property['name'], $attributes)) {
             $propArray[$property['name']] = $attributes[$property['name']];
         }
     }
     $this->params = json_encode($propArray);
     return parent::setAttributes($attributes, $format);
 }