本文整理汇总了PHP中Sprig::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Sprig::create方法的具体用法?PHP Sprig::create怎么用?PHP Sprig::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprig
的用法示例。
在下文中一共展示了Sprig::create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Overload Sprig::create() to create new version
* entry upon creation
*/
public function create()
{
Kohana::$log->add(Kohana::DEBUG, 'Executing Versioned_Sprig::create');
parent::create();
$revision = Sprig::factory($this->_model . '_revision');
$revision->values(array('entry' => $this->{$this->_primary_key}, 'version' => $this->version, 'editor' => $this->editor));
return $revision->create();
}
示例2: create
public function create()
{
// Set hash of the user agent
$this->user_agent = sha1(Request::$user_agent);
// Create a new token each time the token is saved
$this->token = $this->create_token();
return parent::create();
}
示例3: create
public function create()
{
// first, simply create the array as usual
parent::create();
// check if there are already values set, and save them
if (!empty($this->_updatedarray)) {
$this->update();
}
return $this;
}
示例4: create
public function create()
{
// 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::create();
}
示例5: create
public function create($role_name = false)
{
parent::create();
if (!empty($role_name)) {
$role = Sprig::factory('role', array('name' => $role_name))->load();
if ($role->loaded()) {
$role_user = Sprig::factory('roleuser', array('user_id' => $this->id, 'role_id' => $role->id));
$role_user->create();
if (empty($role_user->user_id)) {
$this->delete();
}
}
}
}
示例6: create
public function create()
{
$return = parent::create();
// Pass the create function to the parent
//-------------------
// Add the related Component to the Autoloader-paths, so it can be found by Kohana
//-------------------
// Get component path
$componentpath = Wi3::inst()->pathof->pagefiller("default") . "components/";
// Loop over component-modules and add the one for this specific field
$dir = new DirectoryIterator($componentpath);
foreach ($dir as $file) {
if ($file->isDir() and !$file->isDot() and $file->getFilename() == $this->type) {
Kohana::modules(Kohana::modules() + array($file->getPathname()));
continue;
}
}
$component = $this->getComponent();
// Send the component of this field an event notice
$component->fieldevent("create", $this);
return $return;
}
示例7: insert
/**
* Insert the object
*
* Sprig_MPTT|mixed $target target node primary key value or Sprig_MPTT object.
* @param string $copy_left_from target object property to take new left value from
* @param integer $left_offset offset for left value
* @param integer $level_offset offset for level value
* @access protected
* @return Sprig_MPTT
* @throws Validation_Exception
*/
protected function insert($target, $copy_left_from, $left_offset, $level_offset)
{
// Insert should only work on new nodes.. if its already it the tree it needs to be moved!
if ($this->loaded()) {
return FALSE;
}
if (!$target instanceof $this) {
$target = Sprig_MPTT::factory($this->_model, array($this->pk() => $target))->load();
if (!$target->loaded()) {
return FALSE;
}
} else {
$target->reload();
}
$this->lock();
$this->{$this->left_column} = $target->{$copy_left_from} + $left_offset;
$this->{$this->right_column} = $this->{$this->left_column} + 1;
$this->{$this->level_column} = $target->{$this->level_column} + $level_offset;
$this->{$this->scope_column} = $target->{$this->scope_column};
$this->create_space($this->{$this->left_column});
try {
parent::create();
} catch (Exception $e) {
// We had a problem creating - make sure we clean up the tree
$this->delete_space($this->{$this->left_column});
$this->unlock();
throw $e;
}
$this->unlock();
return $this;
}
示例8: create
public function create()
{
$this->_cache_content();
parent::create();
}
示例9: create
public function create()
{
$this->gc();
return parent::create();
}
示例10: create
/**
* Overload the create method to allow for
* nonce generation
*
* @return self
* @access public
*/
public function create()
{
$this->nonce = $this->create_nonce();
return parent::create();
}