public function save($deep = true) { if (!$this->Key) { $this->Key = static::generateUniqueKey(); } parent::save($deep); }
public function save($deep = true) { parent::save($deep); if (($this->isUpdated || $this->isNew) && $this->EndpointID) { Cache::delete("endpoints/{$this->EndpointID}/rewrites"); } }
public function save($deep = true) { parent::save($deep); if (($this->isUpdated || $this->isNew) && $this->KeyID) { Cache::delete("keys/{$this->KeyID}/endpoints"); } }
public function save($deep = true) { parent::save($deep); if ($this->isUpdated || $this->isNew) { Cache::delete('bans'); } }
public function save($deep = true) { // set handle if (!$this->Handle) { $this->Handle = strtolower(static::getUniqueHandle($this->Title)); } return parent::save($deep); }
public function save($new = false, $primary = 'id') { if (parent::save($new, $primary)) { $_SESSION['usr']['upd'] = 1; return true; } else { return false; } }
public function save() { // set handle if (!$this->Handle) { $this->Handle = static::getUniqueHandle($this->Title); } // call parent parent::save(); }
public function save($deep = true) { // set code if (!$this->Code) { $this->Code = \HandleBehavior::getUniqueHandle($this, $this->Title, ['handleField' => 'Code']); } // call parent parent::save($deep); }
public function save($deep = true) { if (!$this->Opened) { $this->Opened = time(); } if ($this->isFieldDirty('Status') && $this->Status == 'closed' && !$this->Closed) { $this->Closed = time(); } parent::save($deep); }
protected function saveModel(ActiveRecord $model, $web_url) { if ($model->save()) { $model->grabImages($web_url); $model->grabTagsFromText(); $this->log("Сохранена модель #{$model->id}"); } else { $this->log("Не могу сохранить модель: ", impode("<br/>", $model->errors_flat_array)); } return $model; }
public function save($deep = true) { // set handle if (!$this->Handle) { $this->Handle = HandleBehavior::generateRandomHandle($this); } if (!$this->Expires) { $this->Expires = time() + 3600 * static::$expirationHours; } // call parent parent::save($deep); }
public function save($deep = true) { // set handle if (!$this->Handle) { $this->Handle = HandleBehavior::generateRandomHandle($this, 4); } // update PK if (!$this->ContextID && $this->Context && !$this->Context->isPhantom) { $this->ContextID = $this->Context->ID; } // call parent parent::save($deep); }
public function save($forceOperation = null) { $this->executePlugins($this, 'before-save'); if ($this instanceof EavAble && $this->eavObject->get() && !$this->eavObject->get()->getID() && $this->isSpecificationLoaded() && $this->getSpecification()->hasValues()) { $eavObject = $this->eavObject->get(); $this->eavObject->setNull(); } $res = parent::save($forceOperation); if (isset($eavObject)) { $eavObject->save(); $this->eavObject->set($eavObject); $this->save(); } if ($this instanceof EavAble && $this->specificationInstance && $this->eavObject->get()) { if ($this->specificationInstance->hasValues()) { $this->specificationInstance->save(); } else { $this->eavObject->get()->delete(); } } $this->executePlugins($this, 'after-save'); return $res; }
public function save($deep = true) { HandleBehavior::onSave($this, $this->Headline); parent::save($deep); }
<?php require_once 'activerecord.php'; $ar = new ActiveRecord(); $ar->connectPdo('blogdb', 'blog', $_POST['username'], $_POST['password']); $postid = $ar->size() + 1; $ar->pagenum = $postid; $ar->author = $_POST['username']; $ar->date = date('Y/m/d'); $ar->title = $_POST['title']; $ar->text = nl2br($_POST['text']); try { $ar->save(); } catch (Exception $e) { echo $e->getMessage(); return; } $ar->connectPdo('blogdb', 'categorytable', $_POST['username'], $_POST['password']); $categories = explode(',', $_POST["category"]); foreach ($categories as $category) { $ar->postid = $postid; $ar->category = $category; try { $ar->save(); } catch (Exception $e) { echo $e->getMessage(); $ar->connectPdo('blogdb', 'blog', $_POST['username'], $_POST['password']); $postid = $ar->size(); $ar->delete($postid); return; }
public function save($deep = true) { // set handle if (!$this->Handle) { $this->Handle = HandleBehavior::generateRandomHandle($this); } // call parent parent::save($deep); // set cookie setcookie(static::$cookieName, $this->Handle, static::$cookieExpires ? time() + static::$cookieExpires : 0, static::$cookiePath, static::$cookieDomain, static::$cookieSecure); }
/** * Update "current" translation object * @param ActiveRecord $translate */ public function updateTranslation($translate) { foreach ($this->translateAttributes as $attr) { $translate->{$attr} = $this->owner->{$attr}; } $translate->save(false, false, false); }
public function save($deep = true) { HandleBehavior::onSave($this, $this->Title); return parent::save(true); }
public function save($forceOperation = null) { $this->executePlugins($this, 'before-save'); if ($this instanceof EavAble && $this->eavObject->get() && !$this->eavObject->get()->getID() && $this->isSpecificationLoaded() && $this->getSpecification()->hasValues()) { $eavObject = $this->eavObject->get(); $this->eavObject->setNull(); } $res = parent::save($forceOperation); if (isset($eavObject)) { $eavObject->save(); $this->eavObject->set($eavObject); $this->save(); } if ($this instanceof EavAble && $this->specificationInstance && $this->eavObject->get()) { if ($this->specificationInstance->hasValues()) { $this->specificationInstance->save(); } else { $this->eavObject->get()->delete(); } } $this->executePlugins($this, 'after-save'); $cache = self::getApplication()->getCache(); if ($cache instanceof MemCachedCache) { $cache->set($this->getRecordIdentifier($this), $this); } return $res; }
public function save($deep = true) { $wasDirty = false; if ($this->isDirty) { $wasDirty = true; } // save record as usual $return = parent::save($deep); if ($wasDirty) { // save a copy to history table $recordValues = $this->_prepareRecordValues(); // maintain legacy behavior if trackModified is disabled and overwrite Creator if (!static::$trackModified) { $recordValues['Created'] = 'CURRENT_TIMESTAMP'; $recordValues['CreatorID'] = !empty($_SESSION) && !empty($_SESSION['User']) ? $_SESSION['User']->ID : null; } $set = static::_mapValuesToSet($recordValues); DB::nonQuery('INSERT INTO `%s` SET %s', array(static::getHistoryTableName(), join(',', $set))); } }
function save() { $this->discountIfInternalProject(); parent::save(); }