<?php
/**
* Copyright (c) 2019, MND Next GmbH - www.mndnext.de
*/
namespace App\Entity;
use App\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Security\Core\Util\SecureRandom;
/**
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="admins")
*/
class Admin extends BaseUser
{
public const ROLE_ADMIN = 'ROLE_ADMIN';
public const ROLE_NEW_ADMIN = 'ROLE_NEW_ADMIN';
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
* @ORM\Column(name="firstname", type="string", length=255, nullable=true)
* @Assert\NotBlank(message="Bitte geben Sie Ihren Vornamen ein.", groups={"Registration", "Profile"})
*/
private $firstname;
/**
* @var string
* @ORM\Column(name="lastname", type="string", length=255, nullable=true)
* @Assert\NotBlank(message="Bitte geben Sie Ihren Nachnamen ein.", groups={"Registration", "Profile"})
*/
private $lastname;
/**
* @Assert\Regex(
* pattern="/^(?=.*?[a-zA-Z])(?=.*?[0-9])(?=.*?[!$%&=?ยง#+*,;-_\/\\]).{12,}$/",
* message="Das Passwort muss mindestens 12 Zeichen lang sein, Zahlen, Buchstaben und und mindestens ein Sonderzeichen enthalten."
* )
*/
protected $plainPassword;
public function __construct()
{
parent::__construct();
$this->registrations = new \Doctrine\Common\Collections\ArrayCollection();
}
public function setFirstname($firstname)
{
$this->firstname = $firstname;
return $this;
}
public function getFirstname()
{
return $this->firstname;
}
public function setLastname($lastname)
{
$this->lastname = $lastname;
return $this;
}
public function getLastname()
{
return $this->lastname;
}
public function setSalutation($salutation)
{
$this->salutation = $salutation;
return $this;
}
public function getName()
{
return $this->getFirstname() . ' ' . $this->getLastname();
}
public function setEmail($email)
{
parent::setEmail($email);
$this->setUsername($email);
}
public function getEmail()
{
return parent::getEmail();
}
}