/** * Constructor * * @param \Zend\Db\Adapter\Adapter $adapter Database adapter */ public function __construct($adapter) { parent::__construct('id', 'tags', $adapter); }
/** * Constructor * * @param \Zend\Db\Adapter\Adapter $adapter Database adapter */ public function __construct($adapter) { parent::__construct('id', 'resource', $adapter); }
/** * Destroy the list. * * @param \VuFind\Db\Row\User|bool $user Logged-in user (false if none) * @param bool $force Should we force the delete without * checking permissions? * * @return int The number of rows deleted. */ public function delete($user = false, $force = false) { if (!$force && !$this->editAllowed($user)) { throw new ListPermissionException('list_access_denied'); } // Remove user_resource and resource_tags rows: $userResource = $this->getDbTable('UserResource'); $userResource->destroyLinks(null, $this->user_id, $this->id); // Remove the list itself: return parent::delete(); }
/** * Destroy the user. * * @return int The number of rows deleted. */ public function delete() { // Remove all lists owned by the user: $lists = $this->getLists(); $table = $this->getDbTable('UserList'); foreach ($lists as $current) { // The rows returned by getLists() are read-only, so we need to retrieve // a new object for each row in order to perform a delete operation: $list = $table->getExisting($current->id); $list->delete($this, true); } // Remove the user itself: return parent::delete(); }