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 attachments
     foreach ($this->attachments('list') as $attachment) {
         if (!$attachment->delete()) {
             $this->setError($attachment->getError());
             return false;
         }
     }
     // Remove watchers
     foreach ($this->watchers('list') as $watcher) {
         if (!$this->stopWatching($watcher->user_id)) {
             return false;
         }
     }
     // Remove comments
     foreach ($this->comments('list') as $comment) {
         if (!$comment->delete()) {
             $this->setError($comment->getError());
             return false;
         }
     }
     return parent::delete();
 }
Exemple #2
0
 /**
  * Delete a record
  *
  * @return  boolean True on success, false on error
  */
 public function delete()
 {
     // Get some data for the log
     $log = new \stdClass();
     foreach ($this->_tbl->getProperties() as $key => $value) {
         $log->{$key} = $value;
     }
     $log = json_encode($log);
     // Get the scope ID
     $scope_id = $this->get('id');
     if ($res = parent::delete()) {
         // Log the event
         $this->log($scope_id, $this->_scope, 'delete', $log);
     }
     return $res;
 }
Exemple #3
0
 /**
  * Delete Calendar
  *
  * @return [type] [description]
  */
 public function delete($deleteEvents = false)
 {
     // if subscription delete events
     if ($this->isSubscription() || $deleteEvents) {
         // delete events
         $sql = "DELETE FROM `#__events` WHERE `calendar_id`=" . $this->_db->quote($this->get('id'));
         $this->_db->setQuery($sql);
         $this->_db->query();
     } else {
         // update all events, resetting their calendar
         $sql = "UPDATE `#__events` SET `calendar_id`=0 WHERE `calendar_id`=" . $this->_db->quote($this->get('id'));
         $this->_db->setQuery($sql);
         $this->_db->query();
     }
     // delete calendar
     parent::delete();
 }
Exemple #4
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->replies('list') as $comment) {
         if (!$comment->delete()) {
             $this->setError($comment->getError());
             return false;
         }
     }
     return parent::delete();
 }
 /**
  * Delete record and associated file
  *
  * @return  boolean
  */
 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     if ($this->hasFile()) {
         $file = $this->get('filename');
         $path = $this->link('filepath');
         if (!\Filesystem::delete($path)) {
             $this->setError(Lang::txt('COM_SUPPORT_ERROR_UNABLE_TO_DELETE_FILE', $file));
             return false;
         }
     }
     return true;
 }