當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model::save方法代碼示例

本文整理匯總了PHP中Phalcon\Mvc\Model::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::save方法的具體用法?PHP Model::save怎麽用?PHP Model::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phalcon\Mvc\Model的用法示例。


在下文中一共展示了Model::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 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;
 }
開發者ID:nbtetreault,項目名稱:igo,代碼行數:8,代碼來源:IgoClasse.php

示例2: save

 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;
 }
開發者ID:aforward,項目名稱:phpweb,代碼行數:9,代碼來源:BaseModels.php

示例3: save

 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;
 }
開發者ID:nbtetreault,項目名稱:igo,代碼行數:10,代碼來源:IgoGeometrie.php

示例4: save

 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;
 }
開發者ID:remk-wadriga,項目名稱:phalcon-base-application-project,代碼行數:11,代碼來源:ModelAbstract.php

示例5: save

 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);
 }
開發者ID:rj28,項目名稱:test,代碼行數:11,代碼來源:Model.php

示例6: saveModel

 /**
  * 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);
 }
開發者ID:willmontiel,項目名稱:sayvot,代碼行數:21,代碼來源:ControllerBase.php

示例7: save

 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;
 }
開發者ID:Archcry,項目名稱:PhalconApiBase,代碼行數:15,代碼來源:Model.php

示例8: save

 /**
  * 保存模型
  *
  * @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);
 }
開發者ID:sujinw,項目名稱:passport,代碼行數:14,代碼來源:ModelProvider.php

示例9: save

 public function save($saveMapFile = true, $data = NULL, $whiteList = NULL)
 {
     $retour = parent::save($data, $whiteList);
     if ($saveMapFile && $retour) {
         $this->saveMapFile();
     }
     return $retour;
 }
開發者ID:benoitlesp,項目名稱:igo,代碼行數:8,代碼來源:IgoContexte.php

示例10: save

 public function save($data = null, $whiteList = null)
 {
     $this->date = date("Y-m-d H:i:s");
     parent::save($data, $whiteList);
 }
開發者ID:jstacoder,項目名稱:phalcon-rps,代碼行數:5,代碼來源:PlayedGames.php

示例11: save

 /**
  * 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;
 }
開發者ID:ParisPar,項目名稱:learning-phalcon,代碼行數:30,代碼來源:BaseManager.php

示例12: save

 public function save($data = [], $whitelist = [])
 {
     if (!parent::save($data, $whitelist)) {
         throw new SaveException();
     }
 }
開發者ID:caiofralmeida,項目名稱:soccer-company-event,代碼行數:6,代碼來源:Evento.php

示例13: save

 public function save($data = null, $whiteList = null)
 {
     $this->verifyData();
     parent::save($data, $whiteList);
 }
開發者ID:rostikbalagurak,項目名稱:freeWIFI,代碼行數:5,代碼來源:User.php

示例14: save

 public function save($data = null, $whiteList = null)
 {
     $this->prepareData();
     return parent::save($data, $whiteList);
 }
開發者ID:skullab,項目名稱:area51,代碼行數:5,代碼來源:BaseModel.php

示例15: saveEntity

 /**
  * @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);
 }
開發者ID:sergeytkachenko,項目名稱:angular-gulp-phalcon,代碼行數:18,代碼來源:Cars.php


注:本文中的Phalcon\Mvc\Model::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。