本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例9: save
public function save($saveMapFile = true, $data = NULL, $whiteList = NULL)
{
$retour = parent::save($data, $whiteList);
if ($saveMapFile && $retour) {
$this->saveMapFile();
}
return $retour;
}
示例10: save
public function save($data = null, $whiteList = null)
{
$this->date = date("Y-m-d H:i:s");
parent::save($data, $whiteList);
}
示例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;
}
示例12: save
public function save($data = [], $whitelist = [])
{
if (!parent::save($data, $whitelist)) {
throw new SaveException();
}
}
示例13: save
public function save($data = null, $whiteList = null)
{
$this->verifyData();
parent::save($data, $whiteList);
}
示例14: save
public function save($data = null, $whiteList = null)
{
$this->prepareData();
return parent::save($data, $whiteList);
}
示例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);
}