当前位置: 首页>>代码示例>>PHP>>正文


PHP ORM::save方法代码示例

本文整理汇总了PHP中ORM::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::save方法的具体用法?PHP ORM::save怎么用?PHP ORM::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ORM的用法示例。


在下文中一共展示了ORM::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Create operation
  *
  * @param  array $data
  * @return ORM
  */
 public function create(array $data = array())
 {
     foreach ($data as $column => $value) {
         $this->orm->set($column, $value);
     }
     return $this->orm->save();
 }
开发者ID:nergal,项目名称:kohana-libs,代码行数:13,代码来源:service.php

示例2: save

     }
     return $this;
 }
 public function save(Validation $val = null)
 {
     if (!$this->loaded()) {
         $this->created = time();
开发者ID:artbypravesh,项目名称:morningpages,代码行数:7,代码来源:Mail.php

示例3: save

 public function save()
 {
     if (empty($this->moderation_status_id)) {
         $this->moderation_status_id = self::REVIEW_STATUS;
     }
     parent::save();
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:7,代码来源:comment.php

示例4: save

 /**
  * Override the save method to clear cache
  */
 public function save(Validation $validation = NULL)
 {
     parent::save($validation);
     //cleanup the cache
     Cache::instance('roles')->delete_all();
     return $this;
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:10,代码来源:role.php

示例5: save

 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save()
 {
     if ($this->loaded === FALSE) {
         $this->time = time();
     }
     return parent::save();
 }
开发者ID:plusjade,项目名称:pluspanda-php,代码行数:11,代码来源:log.php

示例6: save

 public function save(Validation $validation = NULL)
 {
     if (!$this->loaded()) {
         //$this->maybe_notify();
     }
     parent::save($validation);
 }
开发者ID:Thanandar,项目名称:GiftCircle,代码行数:7,代码来源:friend.php

示例7: save

 public function save()
 {
     if (array_key_exists($this->_columns['password'], $this->_changed)) {
         $this->_object[$this->_columns['password']] = A1::instance($this->_config)->hash_password($this->_object[$this->_columns['password']]);
     }
     return parent::save();
 }
开发者ID:smgladkovskiy,项目名称:A1,代码行数:7,代码来源:user.php

示例8: save

 public function save()
 {
     if (!empty($this->changed)) {
         $this->updated = time();
     }
     return parent::save();
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:7,代码来源:task.php

示例9: save

 /**
  * Overload ORM::save() to update the MPTT tree when we add new items to the hierarchy.
  *
  * @chainable
  * @return  ORM
  */
 function save()
 {
     if (!$this->loaded()) {
         $this->lock();
         $parent = ORM::factory("item", $this->parent_id);
         try {
             // Make a hole in the parent for this new item
             db::build()->update($this->table_name)->set("left_ptr", new Database_Expression("`left_ptr` + 2"))->where("left_ptr", ">=", $parent->right_ptr)->execute();
             db::build()->update($this->table_name)->set("right_ptr", new Database_Expression("`right_ptr` + 2"))->where("right_ptr", ">=", $parent->right_ptr)->execute();
             $parent->right_ptr += 2;
             // Insert this item into the hole
             $this->left_ptr = $parent->right_ptr - 2;
             $this->right_ptr = $parent->right_ptr - 1;
             $this->parent_id = $parent->id;
             $this->level = $parent->level + 1;
         } catch (Exception $e) {
             $this->unlock();
             throw $e;
         }
         parent::save();
         $this->unlock();
     } else {
         parent::save();
     }
     return $this;
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:32,代码来源:ORM_MPTT.php

示例10: save

 /**
  * Overload ORM::save() to trigger an item_related_update event for all items that are related
  * to this tag.
  */
 public function save()
 {
     // Check to see if another tag exists with the same name
     $duplicate_tag = ORM::factory("tag")->where("name", "=", $this->name)->where("id", "!=", $this->id)->find();
     if ($duplicate_tag->loaded()) {
         // If so, tag its items with this tag so as to merge it
         $duplicate_tag_items = ORM::factory("item")->join("items_tags", "items.id", "items_tags.item_id")->where("items_tags.tag_id", "=", $duplicate_tag->id)->find_all();
         foreach ($duplicate_tag_items as $item) {
             $this->add($item);
         }
         // ... and remove the duplicate tag
         $duplicate_tag->delete();
     }
     if (isset($this->object_relations["items"])) {
         $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]);
         $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]);
         if (isset($this->changed_relations["items"])) {
             $changed = array_merge($added, $removed);
         }
         $this->count = count($this->object_relations["items"]) + count($added) - count($removed);
     }
     $result = parent::save();
     if (!empty($changed)) {
         foreach (ORM::factory("item")->where("id", "IN", $changed)->find_all() as $item) {
             module::event("item_related_update", $item);
         }
     }
     return $result;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:33,代码来源:tag.php

示例11: save

 /**
  * Overload saving to perform additional functions on the channel_filter
  */
 public function save(Validation $validation = NULL)
 {
     $ret = parent::save();
     // Run post_save events
     Swiftriver_Event::run('swiftriver.channel.option.post_save', $this);
     return $ret;
 }
开发者ID:rukku,项目名称:SwiftRiver,代码行数:10,代码来源:option.php

示例12: save

 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save()
 {
     if ($this->loaded === FALSE) {
         #TODO: increase the post reply count by one.
     }
     return parent::save();
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:11,代码来源:forum_comment_vote.php

示例13: save

 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save()
 {
     if ($this->loaded === FALSE) {
     }
     $this->token = $this->create_token();
     return parent::save();
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:11,代码来源:auth_user.php

示例14: save

 public function save()
 {
     if (empty($this->code)) {
         $this->code = sha1($this->title . $this->created . $this->user_id);
     }
     parent::save();
 }
开发者ID:jmhobbs,项目名称:q-aargh,代码行数:7,代码来源:island.php

示例15: save

 public function save(Validation $validation = NULL)
 {
     $this->user_id = User::active_user()->id;
     $this->client_id = sha1($this->user_id . uniqid() . microtime());
     $this->client_secret = sha1($this->user_id . uniqid() . microtime());
     return parent::save($validation);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:7,代码来源:oaclient.php


注:本文中的ORM::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。