Exemplo n.º 1
0
 public function save($saveMapFile = true, $data = NULL, $whiteList = NULL)
 {
     $retour = parent::save($data, $whiteList);
     if ($saveMapFile && $this->IgoCouche->IgoGeometrie->acces == "L") {
         $this->IgoCouche->save();
     }
     return $retour;
 }
Exemplo n.º 2
0
 public function save($data = null, $whitelist = null)
 {
     $results = parent::save($data, $whitelist);
     // Update order of child entities
     if (isset($data['childSortOrder'])) {
         $this->updateChildSortOrder($data['childSortOrder']);
     }
     return $results;
 }
Exemplo n.º 3
0
 public function save($saveMapFile = true, $data = NULL, $whiteList = NULL)
 {
     $retour = parent::save($data, $whiteList);
     if ($saveMapFile && $this->acces == "L") {
         foreach ($this->IgoCouche as $couche) {
             $couche->saveMapFile();
         }
     }
     return $retour;
 }
 public function save($data = null, $whiteList = null)
 {
     $this->_isNew = !isset($this->id);
     $data = $this->beforeSave($data);
     if (!is_array($data)) {
         return false;
     }
     $result = parent::save($data, $whiteList);
     $this->afterSave($data);
     return $result;
 }
Exemplo n.º 5
0
Arquivo: Model.php Projeto: rj28/test
 public function save($data = null, $whiteList = null)
 {
     $ref = new ReflectionClass($this);
     if ($ref->hasProperty('created_at') && !$this->created_at) {
         $this->created_at = date('Y-m-d H:i:s');
     }
     if ($ref->hasProperty('modified_at')) {
         $this->modified_at = date('Y-m-d H:i:s');
     }
     return parent::save($data, $whiteList);
 }
Exemplo n.º 6
0
 /**
  * Guarda el modelo que le es pasado por párametro, y un mensaje en caso de exito en el flashSession, genera una Excepción en caso de error 
  * @param \Phalcon\Mvc\Model $model
  * @param String $successMsg
  * @return boolean
  * @throws InvalidArgumentException
  */
 protected function saveModel($model, $successMsg)
 {
     if ($model->save()) {
         if (!empty($successMsg)) {
             $this->flashSession->success($successMsg);
         }
         return true;
     }
     $m = "";
     foreach ($model->getMessages() as $msg) {
         $m .= $msg . "<br>";
     }
     throw new InvalidArgumentException($m);
 }
Exemplo n.º 7
0
 public function save($data = null, $whiteList = null)
 {
     $response = array();
     if (parent::save($data, $whiteList) == false) {
         foreach (parent::getMessages() as $message) {
             $response['errors'][] = (string) $message;
         }
     } else {
         foreach (parent::toArray() as $key => $value) {
             $response[$key] = $value;
         }
         $response['msg'] = 'ok';
     }
     return $response;
 }
Exemplo n.º 8
0
 /**
  * 保存模型
  *
  * @param array $data
  * @param array $whiteList
  * @return bool
  */
 public function save($data = null, $whiteList = null)
 {
     if ($cache = static::getCache()) {
         $cache->replace(static::$cacheChildNamespace, array($this->{static::$primaryKey}), $this, self::$cacheExpire);
     }
     return parent::save($data, $whiteList);
 }
Exemplo n.º 9
0
 public function save($saveMapFile = true, $data = NULL, $whiteList = NULL)
 {
     $retour = parent::save($data, $whiteList);
     if ($saveMapFile && $retour) {
         $this->saveMapFile();
     }
     return $retour;
 }
Exemplo n.º 10
0
 public function save($data = null, $whiteList = null)
 {
     $this->date = date("Y-m-d H:i:s");
     parent::save($data, $whiteList);
 }
Exemplo n.º 11
0
 /**
  * Save/Create/Update an object
  *
  * @param  \Phalcon\Mvc\Model $object
  * @param  string             $type
  * @throws \Exception
  * @return Object
  */
 public function save($object, $type = 'save')
 {
     switch ($type) {
         case 'save':
             $result = $object->save();
             break;
         case 'create':
             $result = $object->create();
             break;
         case 'update':
             $result = $object->update();
             break;
     }
     if (false === $result) {
         foreach ($object->getMessages() as $message) {
             $error[] = (string) $message;
         }
         $output = count($error) > 1 ? json_encode($error) : $error[0];
         throw new \Exception($output);
     }
     return $object;
 }
Exemplo n.º 12
0
 public function save($data = [], $whitelist = [])
 {
     if (!parent::save($data, $whitelist)) {
         throw new SaveException();
     }
 }
Exemplo n.º 13
0
 public function save($data = null, $whiteList = null)
 {
     $this->verifyData();
     parent::save($data, $whiteList);
 }
Exemplo n.º 14
0
 public function save($data = null, $whiteList = null)
 {
     $this->prepareData();
     return parent::save($data, $whiteList);
 }
Exemplo n.º 15
0
 /**
  * @param \Phalcon\Mvc\Model $car
  *  @param \Lib\Import\Column[] $columns
  * @return bool|void
  */
 protected function saveEntity(\Phalcon\Mvc\Model $car, array $columns)
 {
     if (!$car->id) {
         $car->save();
     }
     $priceColumn = $columns[self::CAR_PRICE];
     $price = $priceColumn->getValue();
     $usd = doubleval($price / 25);
     $carPriceParams = array('car_id' => $car->id, 'usd' => $usd);
     $carPrices = \CarPrices::findFirst(array('car_id = :car_id: AND usd = :usd: AND dealer_id IS NULL', 'bind' => $carPriceParams));
     $carPrices = $carPrices ? $carPrices : new \CarPrices();
     $carPrices->save($carPriceParams);
 }