public function search(array $post) { $menuId = (int) $post['menuId']; unset($post['menuId']); $this->getMapper()->setMenuId($menuId); return parent::search($post); }
/** * @param NewsletterModel $model * @return int * @throws \UthandoCommon\Service\ServiceException */ public function toggleVisible(NewsletterModel $model) { $this->removeCacheItem($model->getNewsletterId()); $visible = true === $model->isVisible() ? false : true; $model->setVisible($visible); return parent::save($model); }
/** * @param array $post * @return \Zend\Db\ResultSet\HydratingResultSet|\Zend\Db\ResultSet\ResultSet|\Zend\Paginator\Paginator */ public function search(array $post) { $models = parent::search($post); if ($this->isPopulate()) { foreach ($models as $model) { $this->populate($model, true); } } return $models; }
/** * Delete user from database * * @param int $id * @return int * @throws \UthandoUser\UthandoUserException * @deprecated moving to event listener */ public function delete($id) { $id = (int) $id; /* @var $auth \Zend\Authentication\AuthenticationService */ $auth = $this->getService('Zend\\Authentication\\AuthenticationService'); $identity = $auth->getIdentity(); // sanity check to see if we are deleting ourselves! if ($id == $identity->getUserId()) { throw new UthandoUserException('You cannot delete yourself!'); } return parent::delete($id); }