src/Entity/InvitationRecipient.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Timestampable\Traits\TimestampableEntity;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Wandi\ToolsBundle\Util\TokenGenerator;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\InvitationRecipientRepository")
  9.  */
  10. class InvitationRecipient
  11. {
  12.     use TimestampableEntity;
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=128)
  21.      * @Assert\NotBlank()
  22.      */
  23.     private $email;
  24.     /**
  25.      * @ORM\Column(type="string", length=20, nullable=true)
  26.      */
  27.     private $token;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity="App\Entity\Invitation", inversedBy="recipients")
  30.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  31.      */
  32.     private $invitation;
  33.     /**
  34.      * @ORM\Column(type="boolean")
  35.      * @Assert\Type("bool")
  36.      */
  37.     private $registered;
  38.     /**
  39.      * @var \DateTime
  40.      *
  41.      * @ORM\Column(type="datetime", nullable=true)
  42.      */
  43.     protected $registeredAt;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  46.      * @ORM\JoinColumn(nullable=true)
  47.      */
  48.     private $user;
  49.     /**
  50.      * Article constructor.
  51.      */
  52.     public function __construct()
  53.     {
  54.         $this->token TokenGenerator::generate(20);
  55.         $this->registered false;
  56.     }
  57.     public function __toString()
  58.     {
  59.         return $this->email;
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getEmail(): ?string
  66.     {
  67.         return $this->email;
  68.     }
  69.     public function setEmail(string $email): self
  70.     {
  71.         $this->email $email;
  72.         return $this;
  73.     }
  74.     public function getToken(): ?string
  75.     {
  76.         return $this->token;
  77.     }
  78.     public function setToken(?string $token): self
  79.     {
  80.         $this->token $token;
  81.         return $this;
  82.     }
  83.     public function getRegistered(): ?bool
  84.     {
  85.         return $this->registered;
  86.     }
  87.     public function setRegistered(bool $registered): self
  88.     {
  89.         $this->registered $registered;
  90.         return $this;
  91.     }
  92.     public function getInvitation(): ?Invitation
  93.     {
  94.         return $this->invitation;
  95.     }
  96.     public function setInvitation(?Invitation $invitation): self
  97.     {
  98.         $this->invitation $invitation;
  99.         return $this;
  100.     }
  101.     public function getRegisteredAt(): ?\DateTime
  102.     {
  103.         return $this->registeredAt;
  104.     }
  105.     public function setRegisteredAt(?\DateTime $registeredAt null): self
  106.     {
  107.         $this->registeredAt $registeredAt;
  108.         return $this;
  109.     }
  110.     public function getUser(): ?user
  111.     {
  112.         return $this->user;
  113.     }
  114.     public function setUser(?user $user null): self
  115.     {
  116.         $this->user $user;
  117.         return $this;
  118.     }
  119. }