本文整理汇总了PHP中Sprig::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Sprig::delete方法的具体用法?PHP Sprig::delete怎么用?PHP Sprig::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprig
的用法示例。
在下文中一共展示了Sprig::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete(Database_Query_Builder_Delete $query = NULL)
{
//-------------------
// 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;
}
}
// For robustness, do not assume a field-type
if (!empty($this->type)) {
$component = $this->getComponent();
// Send the component of this field an event notice
$component->fieldevent("delete", $this);
}
// Finally delete the field
return parent::delete($query);
// Pass the create function to the parent
}
示例2: delete
/**
* Overload Sprig::delete() to update child articles
* to become children of the uncategorized subcategory
*/
public function delete(Database_Query_Builder_Delete $query = NULL) {
Kohana::$log->add(Kohana::DEBUG, 'Beginning subcategory deletion for subcategory_id='.$this->id);
if (Kohana::$profiling === TRUE)
{
$benchmark = Profiler::start('blog', 'delete subcategory');
}
$uncategorized = Sprig::factory('subcategory', array('name'=>'uncategorized'))->load();
// Modify category IDs for all child articles
try
{
DB::update('articles')->value('subcategory_id', $uncategorized->id)
->where('subcategory_id', '=', $this->id)->execute();
}
catch (Database_Exception $e)
{
Kohana::$log->add(Kohana::ERROR, 'Exception occured while modifying deleted subcategory\'s articles. '.$e->getMessage());
return $this;
}
if (isset($benchmark))
{
Profiler::stop($benchmark);
}
return parent::delete($query);
}
示例3: delete
public function delete(Database_Query_Builder_Delete $query = NULL)
{
// If not loaded, then load
if (!$this->loaded()) {
$this->load();
}
// Delete all coupled urls
foreach ($this->urls as $url) {
$url->delete();
}
// Go ahead with primary deletion
parent::delete();
}
示例4: delete
/**
* Overload Sprig::delete() to remove child articles
* from the article-tag pivot table
*/
public function delete(Database_Query_Builder_Delete $query = NULL)
{
Kohana::$log->add(Kohana::DEBUG, 'Beginning tag deletion for tag_id=' . $this->id);
if (Kohana::$profiling === TRUE) {
$benchmark = Profiler::start('blog', 'delete tag');
}
try {
DB::delete('articles_tags')->where('tag_id', '=', $this->id)->execute();
} catch (Database_Exception $e) {
Kohana::$log->add(Kohana::ERROR, 'Exception occured while modifying deleted tag\'s articles. ' . $e->getMessage());
return $this;
}
if (isset($benchmark)) {
Profiler::stop($benchmark);
}
return parent::delete($query);
}
示例5: delete
public function delete(Database_Query_Builder_Delete $query = NULL)
{
if (!$query) {
// remove all the arraydata that belongs to this object
$this->loadarraydata();
// Make sure that existing arraydata is loaded
foreach ($this->__GET("_arraydatas") as $result) {
$result->delete();
}
parent::delete();
} else {
parent::delete($query);
}
}
示例6: delete
/**
* Overload Sprig::delete() to remove
* file from the upload dir
*/
public function delete(Database_Query_Builder_Delete $query = NULL) {
Kohana::$log->add(Kohana::DEBUG, 'Beginning photo deletion');
if (Kohana::$profiling === TRUE)
{
$benchmark = Profiler::start('photo', 'delete photo');
}
if(file_exists($this->path))
unlink($this->path);
if (isset($benchmark))
{
Profiler::stop($benchmark);
}
return parent::delete($query);
}