当前位置: 首页>>代码示例>>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;未经允许,请勿转载。