Inheritance: extends Sulu\Bundle\CoreBundle\Entity\ApiEntity, implements Sulu\Component\Security\Authentication\UserInterface, implements Serializabl\Serializable
Example #1
0
 /**
  * {@inheritdoc}
  *
  * @VirtualProperty
  */
 public function getRoles()
 {
     $roles = parent::getRoles();
     foreach ($this->getUserRoles() as $userRole) {
         /* @var UserRole $userRole */
         $roles[] = $userRole->getRole()->getIdentifier();
     }
     return $roles;
 }
 /**
  * @param Form $form
  * @param BaseUser $user
  */
 protected function setPasswordAndSalt(Form $form, BaseUser &$user)
 {
     if ($form->has('plainPassword') && ($newPassword = $form->get('plainPassword')->getData())) {
         // generate salt if not exist
         if (!$user->getSalt()) {
             $user->setSalt($this->getRandomSalt());
         }
         $user->setPassword($this->getEncodedPassword($user, $newPassword));
     }
 }