/** * {@inheritDoc} */ public function getPlainPassword() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPlainPassword', array()); return parent::getPlainPassword(); }
public function changePassword(User $User) { if (null == $User->getPlainPassword()) { throw new UserException('Nie ustawiono nowego hasła'); } $encoder = $this->encoderFactory->getEncoder($User); $encoderPassword = $encoder->encodePassword($User->getPlainPassword(), $User->getSalt()); $User->setPassword($encoderPassword); $em = $this->doctrine->getManager(); $em->persist($User); $em->flush(); return true; }