src/Entity/Landlords/Landlord.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Landlords;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Symfony\Component\Validator\Constraints AS Constraints;
  5. use Symfony\Component\Validator\Constraints AS Assert;
  6. use Doctrine\ORM\Mapping AS ORM;
  7. use Ramsey\Uuid\Uuid;
  8. use Ramsey\Uuid\Lazy\LazyUuidFromString;
  9. use Symfony\Component\Security\Core\User\UserInterface;
  10. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  11. use App\Entity\BaseEntity;
  12. use App\Entity\Properties\Property;
  13. use App\Entity\Statements\Statement;
  14. /**
  15.  * @ORM\Entity(repositoryClass="App\Repository\Landlords\LandlordRepository")
  16.  * @ORM\Table(name="landlords_landlord")
  17.  */
  18. class Landlord extends BaseEntity implements UserInterfacePasswordAuthenticatedUserInterface
  19. {
  20.     /**
  21.     * @ORM\Id
  22.     * @ORM\GeneratedValue(strategy="AUTO")
  23.     * @ORM\Column(type="integer")
  24.     */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="uuid")
  28.      * @Assert\Uuid
  29.      */
  30.     protected $uuid;
  31.     /**
  32.      * @var \DateTime
  33.      *
  34.      * @ORM\Column(type="datetime", nullable=false)
  35.      * @Assert\Type("\DateTime")
  36.      */
  37.     private $created;
  38.     /**
  39.     * @ORM\Column(type="integer", nullable=false)
  40.     */
  41.     private $reference;
  42.     /**
  43.      * @var \DateTime
  44.      *
  45.      * @ORM\Column(type="datetime", nullable=true)
  46.      */
  47.     private $lastActive;
  48.     /**
  49.      * @ORM\Column(type="string", length=100, unique=true)
  50.      * @Constraints\Email()
  51.      * @Constraints\NotBlank()
  52.      */
  53.     private $email;
  54.     /**
  55.      * @ORM\Column(type="string", length=64, nullable=true)
  56.      */
  57.     private $password;
  58.     /**
  59.     * @ORM\Column(type="string", nullable=false, length="50")
  60.     */
  61.     private $firstNames;
  62.     /**
  63.     * @ORM\Column(type="string", nullable=false, length="50")
  64.     */
  65.     private $lastName;
  66.     /**
  67.     * @ORM\Column(type="string", nullable=true, length="50")
  68.     */
  69.     private $phoneNumber;
  70.     /**
  71.     * @ORM\Column(type="string", nullable=true, length="50")
  72.     */
  73.     private $mobileNumber;
  74.     /**
  75.     * @ORM\Column(type="integer", nullable=false, length="5")
  76.     */
  77.     private $rentPercentageFee;
  78.     /**
  79.      * @ORM\Column(type="string", length=16, nullable=true)
  80.      */
  81.     private $resetToken;
  82.     /**
  83.      * @ORM\OneToMany(targetEntity=Property::class, mappedBy="landlord")
  84.      **/
  85.     private $properties;
  86.     /**
  87.      * @ORM\OneToMany(targetEntity=Statement::class, mappedBy="landlord")
  88.      **/
  89.     private $statements;
  90.     public function __construct(array $defaults = array())
  91.     {
  92.         // Defaults
  93.         $this->setUuid(Uuid::uuid4());
  94.         $this->setCreated(new \DateTime());
  95.         $this->rentPercentageFee 0;
  96.         parent::__construct($defaults);
  97.     }
  98.     public function __toString()
  99.     {
  100.         return $this->getId();
  101.     }
  102.     public function getFullName()
  103.     {
  104.         return implode(" "array_filter([
  105.             $this->getFirstNames(),
  106.             $this->getLastName()
  107.         ]));
  108.     }
  109.     public function getRoles() : array
  110.     {
  111.         return ['ROLE_LANDLORD'];
  112.     }
  113.     public function hasRole($role)
  114.     {
  115.         return in_array($role$this->getRoles());
  116.     }
  117.     public function getUserIdentifier() : string
  118.     {
  119.         return $this->email;
  120.     }
  121.     public function setPassword(string $password null)
  122.     {
  123.         $this->password $password;
  124.     }
  125.     public function getPassword(): ?string
  126.     {
  127.         return $this->password;
  128.     }
  129.     public function eraseCredentials()
  130.     {
  131.     }
  132.     public function getId(): ?int
  133.     {
  134.         return $this->id;
  135.     }
  136.     public function getUuid(): LazyUuidFromString
  137.     {
  138.         return $this->uuid;
  139.     }
  140.     public function setUuid(LazyUuidFromString $uuid): void
  141.     {
  142.         $this->uuid $uuid;
  143.     }
  144.     public function setCreated(\DateTime $created): void
  145.     {
  146.         $this->created $created;
  147.     }
  148.     public function getCreated(): \DateTime
  149.     {
  150.         return $this->created;
  151.     }
  152.     public function getReference()
  153.     {
  154.         return $this->reference;
  155.     }
  156.     public function setReference(int $reference)
  157.     {
  158.         $this->reference $reference;
  159.     }
  160.     public function getFirstNames()
  161.     {
  162.         return $this->firstNames;
  163.     }
  164.     public function setFirstNames(string $firstNames)
  165.     {
  166.         $this->firstNames $firstNames;
  167.         return $this;
  168.     }
  169.     public function getLastName()
  170.     {
  171.         return $this->lastName;
  172.     }
  173.     public function setLastName(string $lastName)
  174.     {
  175.         $this->lastName $lastName;
  176.     }
  177.     public function getPhoneNumber()
  178.     {
  179.         return $this->phoneNumber;
  180.     }
  181.     public function setPhoneNumber(string $phoneNumber null)
  182.     {
  183.         $this->phoneNumber $phoneNumber;
  184.     }
  185.     public function getMobileNumber()
  186.     {
  187.         return $this->mobileNumber;
  188.     }
  189.     public function setMobileNumber(string $mobileNumber null)
  190.     {
  191.         $this->mobileNumber $mobileNumber;
  192.     }
  193.     public function getEmail()
  194.     {
  195.         return $this->email;
  196.     }
  197.     public function setEmail(string $email)
  198.     {
  199.         $this->email $email;
  200.     }
  201.     public function getLastActive()
  202.     {
  203.         return $this->lastActive;
  204.     }
  205.     public function setLastActive(\DateTime $lastActive null)
  206.     {
  207.         $this->lastActive $lastActive;
  208.     }
  209.     public function getRentPercentageFee()
  210.     {
  211.         return $this->rentPercentageFee;
  212.     }
  213.     public function setRentPercentageFee(int $rentPercentageFee)
  214.     {
  215.         $this->rentPercentageFee $rentPercentageFee;
  216.     }
  217.     public function getResetToken()
  218.     {
  219.         return $this->resetToken;
  220.     }
  221.     public function setResetToken(string $resetToken null)
  222.     {
  223.         $this->resetToken $resetToken;
  224.     }
  225. }