/** * @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|ModelInterface $data * @return int * @throws UthandoUserException * @throws \UthandoCommon\Service\ServiceException * @deprecated moving to event listener */ public function save($data) { if ($data instanceof UserModel) { $data = $this->getMapper()->extract($data); } if (array_key_exists('passwd', $data) && '' != $data['passwd']) { $data['passwd'] = $this->createPassword($data['passwd']); } else { unset($data['passwd']); } $result = parent::save($data); return $result; }