public function delete($con = null) { try { $con = Propel::getConnection(); $con->begin(); //deletes generic document $genericDocument = Document::getGenericDocument($this); $genericDocument->delete(); parent::delete(); $con->commit(); Document::deleteObjCache($this); return true; } catch (Exception $e) { $con->rollback(); throw $e; } }
/** * Delete this object * * @param void * @return boolean */ function delete() { if ($this->isAccountOwner()) { return false; } // if ProjectUsers::clearByUser($this); MessageSubscriptions::clearByUser($this); return parent::delete(); } // delete
/** * Delete from database * * @param void * @return boolean */ function delete() { db_begin_work(); $delete = parent::delete(); if ($delete && !is_error($delete)) { unlink($this->getAvatarPath()); unlink($this->getAvatarPath(true)); ProjectUsers::deleteByUser($this); Assignments::deleteByUser($this); Subscriptions::deleteByUser($this); StarredObjects::deleteByUser($this); PinnedProjects::deleteByUser($this); UserConfigOptions::deleteByUser($this); Reminders::deleteByUser($this); search_index_remove($this->getId(), 'User'); $cleanup = array(); event_trigger('on_user_cleanup', array(&$cleanup)); if (is_foreachable($cleanup)) { foreach ($cleanup as $table_name => $fields) { foreach ($fields as $field) { $condition = ''; if (is_array($field)) { $id_field = array_var($field, 'id'); $name_field = array_var($field, 'name'); $email_field = array_var($field, 'email'); $condition = array_var($field, 'condition'); } else { $id_field = $field . '_id'; $name_field = $field . '_name'; $email_field = $field . '_email'; } // if if ($condition) { db_execute('UPDATE ' . TABLE_PREFIX . "{$table_name} SET {$id_field} = 0, {$name_field} = ?, {$email_field} = ? WHERE {$id_field} = ? AND {$condition}", $this->getName(), $this->getEmail(), $this->getId()); } else { db_execute('UPDATE ' . TABLE_PREFIX . "{$table_name} SET {$id_field} = 0, {$name_field} = ?, {$email_field} = ? WHERE {$id_field} = ?", $this->getName(), $this->getEmail(), $this->getId()); } // if } // foreach } // foreach } // if db_commit(); return true; } else { db_rollback(); return $delete; } // if }
/** * Forcibly deletes a user from the DB, taking with it all foreign references * to it (pictures, albums, videos, threads, posts, etc, etc). * * It is very inadvisable to use this method because of the impact that it * can have on other users (if, for instance, this user started a thread, * that thread will be removed). */ public function forceDelete(PropelPDO $con = null) { return parent::delete($con); }
/** * Delete this object * * @param void * @return boolean */ function delete() { if ($this->isAccountOwner()) { return false; } // if $this->deleteAvatar(); //$this->deletePersonalProject(); MailAccountUsers::deleteByUser($this); GroupUsers::clearByUser($this); Contacts::updateUserIdOnUserDelete($this->getId()); ProjectUsers::clearByUser($this); ObjectSubscriptions::clearByUser($this); ObjectReminders::clearByUser($this); EventInvitations::clearByUser($this); UserPasswords::clearByUser($this); return parent::delete(); }
/** * Overrides delete() in App_Model. * * When an user is deleted, all associated objects are also * deleted * * @param mixed $where * @access public * @return int */ public function delete($where) { if (is_numeric($where)) { $where = $this->_primary . ' = ' . $where; } $select = new Zend_Db_Select($this->_db); $select->from($this->_name); $select->where($where); $rows = $this->_db->fetchAll($select); $userGroupModel = new BackofficeUserGroup(); foreach ($rows as $row) { $userGroupModel->deleteByUserId($row['id']); } return parent::delete($where); }