Exemple #1
0
 /**
  * Delete the record and all associated data
  *
  * @return    boolean False if error, True on success
  */
 public function delete()
 {
     // Can't delete what doesn't exist
     if (!$this->exists()) {
         return true;
     }
     // Remove locations
     foreach ($this->locations('list') as $location) {
         if (!$location->delete()) {
             $this->setError($location->getError());
             return false;
         }
     }
     // Check for a picture
     if ($file = $this->get('picture')) {
         // Make sure the picture exists
         if (file_exists($this->logo('path') . DS . $file)) {
             // Remove picture
             if (!\Filesystem::delete($this->logo('path') . DS . $file)) {
                 $this->setError(\Lang::txt('COM_TOOLS_UNABLE_TO_DELETE_FILE'));
             }
         }
     }
     // Attempt to delete the record
     return parent::delete();
 }
Exemple #2
0
 /**
  * Delete the record and all associated data
  *
  * @return    boolean False if error, True on success
  */
 public function delete()
 {
     // Can't delete what doesn't exist
     if (!$this->exists()) {
         return true;
     }
     // Remove comments
     foreach ($this->shared('list') as $shared) {
         if (!$shared->delete()) {
             $this->setError($shared->getError());
             return false;
         }
     }
     // Attempt to delete the record
     return parent::delete();
 }