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 }
/** * 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); }
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(); }
/** * 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); }
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); } }
/** * 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); }