src/Entity/Core/AgenciesHasUsers.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core;
  3. use Doctrine\DBAL\Types\Types;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * Agencies has users
  9.  *
  10.  * @ORM\Table("core_agencies_has_users")
  11.  * @ORM\Entity(repositoryClass="App\Repository\Core\AgenciesHasUsersRepository")
  12.  * @ORM\HasLifecycleCallbacks()
  13.  */
  14. class AgenciesHasUsers
  15. {
  16.     /**
  17.      * @var integer
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     protected $id;
  24.     /**
  25.      * @var string
  26.      *
  27.      * @ORM\Column(name="created_at", type="datetime", nullable=true, options={"comment":"Date de création"})
  28.      */
  29.     private $createdAt;
  30.     /**
  31.      * @var string
  32.      *
  33.      * @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"comment":"Date de mise à jour"})
  34.      */
  35.     private $updatedAt;
  36.     
  37.     /**
  38.      * @var \Agencies
  39.      *
  40.      * @ORM\ManyToOne(targetEntity="App\Entity\Core\Agencies")
  41.      * @ORM\JoinColumns({
  42.      *   @ORM\JoinColumn(name="agencies_id", referencedColumnName="id", nullable=true)
  43.      * })
  44.      */
  45.     protected $agency;
  46.     /**
  47.      * @var \UsersHasContracts
  48.      *
  49.      * @ORM\ManyToOne(targetEntity="App\Entity\Core\Users")
  50.      * @ORM\JoinColumns({
  51.      *   @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
  52.      * })
  53.      */
  54.     protected $user;
  55.     /**
  56.      * @var string
  57.      *
  58.      * @ORM\Column(name="admin", type="boolean", nullable=false)
  59.      */
  60.     private $admin;
  61.     /**
  62.      * @ORM\PrePersist
  63.      */
  64.     public function setCreatedAtValue(): void
  65.     {
  66.         $this->setCreatedAt(new \DateTime("now"));
  67.         $this->setUpdatedAt(new \DateTime("now"));
  68.     }
  69.     /**
  70.      * @ORM\PreUpdate
  71.      */
  72.     public function setUpdatedAtValue(): void
  73.     {
  74.         $this->setUpdatedAt(new \DateTime("now"));
  75.     }
  76.     public function __toString()
  77.     {
  78.         return "#".$this->id;
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getCreatedAt(): ?\DateTimeInterface
  85.     {
  86.         return $this->createdAt;
  87.     }
  88.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  89.     {
  90.         $this->createdAt $createdAt;
  91.         return $this;
  92.     }
  93.     public function getUpdatedAt(): ?\DateTimeInterface
  94.     {
  95.         return $this->updatedAt;
  96.     }
  97.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  98.     {
  99.         $this->updatedAt $updatedAt;
  100.         return $this;
  101.     }
  102.     public function getAdmin(): ?bool
  103.     {
  104.         return $this->admin;
  105.     }
  106.     public function setAdmin(bool $admin): self
  107.     {
  108.         $this->admin $admin;
  109.         return $this;
  110.     }
  111.     public function getAgency(): ?Agencies
  112.     {
  113.         return $this->agency;
  114.     }
  115.     public function setAgency(?Agencies $agency): self
  116.     {
  117.         $this->agency $agency;
  118.         return $this;
  119.     }
  120.     public function getUser(): ?Users
  121.     {
  122.         return $this->user;
  123.     }
  124.     public function setUser(?Users $user): self
  125.     {
  126.         $this->user $user;
  127.         return $this;
  128.     }
  129.     public function isAdmin(): ?bool
  130.     {
  131.         return $this->admin;
  132.     }
  133.     
  134. }