本文整理汇总了PHP中ActiveRecord::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::save方法的具体用法?PHP ActiveRecord::save怎么用?PHP ActiveRecord::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($deep = true)
{
if (!$this->Key) {
$this->Key = static::generateUniqueKey();
}
parent::save($deep);
}
示例2: save
public function save($deep = true)
{
parent::save($deep);
if (($this->isUpdated || $this->isNew) && $this->EndpointID) {
Cache::delete("endpoints/{$this->EndpointID}/rewrites");
}
}
示例3: save
public function save($deep = true)
{
parent::save($deep);
if (($this->isUpdated || $this->isNew) && $this->KeyID) {
Cache::delete("keys/{$this->KeyID}/endpoints");
}
}
示例4: save
public function save($deep = true)
{
parent::save($deep);
if ($this->isUpdated || $this->isNew) {
Cache::delete('bans');
}
}
示例5: save
public function save($deep = true)
{
// set handle
if (!$this->Handle) {
$this->Handle = strtolower(static::getUniqueHandle($this->Title));
}
return parent::save($deep);
}
示例6: save
public function save($new = false, $primary = 'id')
{
if (parent::save($new, $primary)) {
$_SESSION['usr']['upd'] = 1;
return true;
} else {
return false;
}
}
示例7: save
public function save()
{
// set handle
if (!$this->Handle) {
$this->Handle = static::getUniqueHandle($this->Title);
}
// call parent
parent::save();
}
示例8: 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);
}
示例9: save
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);
}
示例10: saveModel
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;
}
示例11: save
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);
}
示例12: save
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);
}
示例13: save
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;
}
示例14: save
public function save($deep = true)
{
HandleBehavior::onSave($this, $this->Headline);
parent::save($deep);
}
示例15: ActiveRecord
<?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;
}