public function delete($key = NULL) { if (parent::delete($key)) { DB::delete('product_search')->where('product_id', '=', $this->id)->execute(); return TRUE; } return FALSE; }
public function delete($key = NULL) { $path = $this->_meta->fields('file')->path; try { unlink($path . $this->file); } catch (Exception $e) { Kohana::$log->add('info', 'Requested remove of ":file". Failed.', array(':file' => $path . $this->file)); } return parent::delete($key); }
public function delete($key = NULL) { foreach ($this->images as $image) { $image->delete(); } $this->reset_priority(); $path = $this->_meta->fields('file')->path; try { unlink($path . $this->file); } catch (Exception $e) { Kohana::$log->add('info', 'Requested remove of ":file". Failed.', array(':file' => $path . $this->file)); } return parent::delete($key); }
/** * Deletes a single image and files * * @param $key A key to use for non-loaded records * @return boolean **/ public function delete($key = null) { if (!$key && $this->loaded()) { // Delete default if (is_file($this->get_filename())) { unlink($this->get_filename()); } // Delete original if (is_file($this->get_filename('original'))) { unlink($this->get_filename('original')); } // Delete other sizes $sizes = Kohana::config('image.sizes'); foreach ($sizes as $size => $config) { if (isset($config['postfix']) && is_file($this->get_filename($size))) { unlink($this->get_filename($size)); } } // Delete exif $this->exif->delete(); } return parent::delete($key); }