src/Entity/Admin.php line 19

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2019, MND Next GmbH - www.mndnext.de
  4.  */
  5. namespace App\Entity;
  6. use App\Entity\User as BaseUser;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use Symfony\Component\HttpFoundation\File\UploadedFile;
  10. use Symfony\Component\Security\Core\Util\SecureRandom;
  11. /**
  12.  * @ORM\Entity
  13.  * @ORM\HasLifecycleCallbacks()
  14.  * @ORM\Table(name="admins")
  15.  */
  16. class Admin extends BaseUser
  17. {
  18.     public const ROLE_ADMIN 'ROLE_ADMIN';
  19.     public const ROLE_NEW_ADMIN 'ROLE_NEW_ADMIN';
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\Column(type="integer")
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     protected $id;
  26.     /**
  27.      * @var string
  28.      * @ORM\Column(name="firstname", type="string", length=255, nullable=true)
  29.      * @Assert\NotBlank(message="Bitte geben Sie Ihren Vornamen ein.", groups={"Registration", "Profile"})
  30.      */
  31.     private $firstname;
  32.     /**
  33.      * @var string
  34.      * @ORM\Column(name="lastname", type="string", length=255, nullable=true)
  35.      * @Assert\NotBlank(message="Bitte geben Sie Ihren Nachnamen ein.", groups={"Registration", "Profile"})
  36.      */
  37.     private $lastname;
  38.     /**
  39.      * @Assert\Regex(
  40.      *  pattern="/^(?=.*?[a-zA-Z])(?=.*?[0-9])(?=.*?[!$%&=?ยง#+*,;-_\/\\]).{12,}$/",
  41.      *  message="Das Passwort muss mindestens 12 Zeichen lang sein, Zahlen, Buchstaben und und mindestens ein Sonderzeichen enthalten."
  42.      * )
  43.      */
  44.     protected $plainPassword;
  45.     public function __construct()
  46.     {
  47.         parent::__construct();
  48.         $this->registrations = new \Doctrine\Common\Collections\ArrayCollection();
  49.     }
  50.     public function setFirstname($firstname)
  51.     {
  52.         $this->firstname $firstname;
  53.         return $this;
  54.     }
  55.     public function getFirstname()
  56.     {
  57.         return $this->firstname;
  58.     }
  59.     public function setLastname($lastname)
  60.     {
  61.         $this->lastname $lastname;
  62.         return $this;
  63.     }
  64.     public function getLastname()
  65.     {
  66.         return $this->lastname;
  67.     }
  68.     public function setSalutation($salutation)
  69.     {
  70.         $this->salutation $salutation;
  71.         return $this;
  72.     }
  73.     public function getName()
  74.     {
  75.         return $this->getFirstname() . ' ' $this->getLastname();
  76.     }
  77.     public function setEmail($email)
  78.     {
  79.         parent::setEmail($email);
  80.         $this->setUsername($email);
  81.     }
  82.     public function getEmail()
  83.     {
  84.         return parent::getEmail();
  85.     }
  86. }