本文整理汇总了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();
}
示例2: save
}
return $this;
}
public function save(Validation $val = null)
{
if (!$this->loaded()) {
$this->created = time();
示例3: save
public function save()
{
if (empty($this->moderation_status_id)) {
$this->moderation_status_id = self::REVIEW_STATUS;
}
parent::save();
}
示例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;
}
示例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();
}
示例6: save
public function save(Validation $validation = NULL)
{
if (!$this->loaded()) {
//$this->maybe_notify();
}
parent::save($validation);
}
示例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();
}
示例8: save
public function save()
{
if (!empty($this->changed)) {
$this->updated = time();
}
return parent::save();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例14: save
public function save()
{
if (empty($this->code)) {
$this->code = sha1($this->title . $this->created . $this->user_id);
}
parent::save();
}
示例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);
}