本文整理汇总了PHP中Sprig::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Sprig::update方法的具体用法?PHP Sprig::update怎么用?PHP Sprig::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprig
的用法示例。
在下文中一共展示了Sprig::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Overload Sprig::update() to save revision change
* @param bump whether to bump the version number
*/
public function update($bump = TRUE)
{
Kohana::$log->add(Kohana::DEBUG, 'Executing Versioned_Sprig::update');
$updated = FALSE;
foreach ($this->_fields as $field => $object) {
if ($object instanceof Sprig_Field_Tracked and $this->changed($field)) {
$this->comment = UTF8::ucwords($object->label) . ' changed from "' . $this->_original[$field] . '" to "' . $this->_changed[$field] . '".';
}
if ($object instanceof Sprig_Field_Versioned and $this->changed($field) and $bump) {
$diff = '';
if ($this->version != 0) {
$diff = Versioned::diff($this->_original[$field], $this->_changed[$field]);
$diff = Versioned::clean_array($diff);
$diff = serialize($diff);
}
$this->version++;
$revision = Sprig::factory($this->_model . '_revision');
$revision->values(array('entry' => $this->id, 'version' => $this->version, 'editor' => $this->editor, 'diff' => $diff));
$revision->comments = $this->comments;
$revision->create();
$updated = TRUE;
$this->comments = array();
}
}
if (!$updated and count($this->comments) > 0) {
$revision = Sprig::factory($this->_model . '_revision');
$revision->entry = $this->id;
$revision->version = $this->version;
$revision->load();
$revision->comments = array_merge($revision->comments, $this->comments);
$revision->update();
}
return parent::update();
}
示例2: update
public function update()
{
// Make sure there are no twig syntax errors
try {
$test = Kohanut_Twig::render($this->code);
} catch (Twig_SyntaxError $e) {
$e->setFilename('code');
throw new Kohanut_Exception("There was a Twig Syntax error: " . $e->getMessage());
} catch (Exception $e) {
throw new Kohanut_Exception("There was an error: " . $e->getMessage() . " on line " . $e->getLine());
}
parent::update();
}
示例3: update
public function update()
{
// Create a new token each time the token is saved
$this->token = $this->create_token();
return parent::update();
}
示例4: update
public function update()
{
$this->_cache_content();
parent::update();
}
示例5: update
public function update()
{
$this->gc();
return parent::update();
}