src/Entity/Agency.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AgencyRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\User;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass=AgencyRepository::class)
  11.  */
  12. class Agency extends User
  13. {
  14.     /**
  15.      * @ORM\Column(type="string", length=255)
  16.      */
  17.     private $title;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $address;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $phone;
  26.     
  27.     /**
  28.      * @ORM\Column(type="boolean")
  29.      */
  30.     private $statut;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Bike::class, mappedBy="agency")
  33.      */
  34.     private $bikes;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Accessory::class, mappedBy="agency")
  37.      */
  38.     private $accessory;
  39.     
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=Event::class, mappedBy="agency")
  42.      */
  43.     private $events;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=History::class, mappedBy="agency")
  46.      */
  47.     private $histories;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="agency")
  50.      */
  51.     private $orders;
  52.     public function __construct()
  53.     {
  54.         $this->bikes = new ArrayCollection();
  55.         $this->accessory = new ArrayCollection();
  56.         $this->events = new ArrayCollection();
  57.         $this->histories = new ArrayCollection();
  58.         $this->orders = new ArrayCollection();
  59.     }
  60.     public function getTitle(): ?string
  61.     {
  62.         return $this->title;
  63.     }
  64.     public function setTitle(string $title): self
  65.     {
  66.         $this->title $title;
  67.         return $this;
  68.     }
  69.     public function getAddress(): ?string
  70.     {
  71.         return $this->address;
  72.     }
  73.     public function setAddress(string $address): self
  74.     {
  75.         $this->address $address;
  76.         return $this;
  77.     }
  78.     public function getPhone(): ?string
  79.     {
  80.         return $this->phone;
  81.     }
  82.     public function setPhone(string $phone): self
  83.     {
  84.         $this->phone $phone;
  85.         return $this;
  86.     }
  87.     public function isStatut(): ?bool
  88.     {
  89.         return $this->statut;
  90.     }
  91.     public function setStatut(bool $statut): self
  92.     {
  93.         $this->statut $statut;
  94.         return $this;
  95.     }
  96.     
  97.     /**
  98.      * @return Collection<int, Bike>
  99.      */
  100.     public function getBikes(): Collection
  101.     {
  102.         return $this->bikes;
  103.     }
  104.     public function addBike(Bike $bike): self
  105.     {
  106.         if (!$this->bikes->contains($bike)) {
  107.             $this->bikes[] = $bike;
  108.             $bike->setAgency($this);
  109.         }
  110.         return $this;
  111.     }
  112.     public function removeBike(Bike $bike): self
  113.     {
  114.         if ($this->bikes->removeElement($bike)) {
  115.             // set the owning side to null (unless already changed)
  116.             if ($bike->getAgency() === $this) {
  117.                 $bike->setAgency(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return Collection<int, Accessory>
  124.      */
  125.     public function getAccessory(): Collection
  126.     {
  127.         return $this->accessory;
  128.     }
  129.     public function addAccessory(Accessory $accessory): self
  130.     {
  131.         if (!$this->accessory->contains($accessory)) {
  132.             $this->accessory[] = $accessory;
  133.             $accessory->setAgency($this);
  134.         }
  135.         return $this;
  136.     }
  137.     public function removeAccessory(Accessory $accessory): self
  138.     {
  139.         if ($this->accessory->removeElement($accessory)) {
  140.             // set the owning side to null (unless already changed)
  141.             if ($accessory->getAgency() === $this) {
  142.                 $accessory->setAgency(null);
  143.             }
  144.         }
  145.         return $this;
  146.     }
  147.     /**
  148.      * @return Collection<int, Event>
  149.      */
  150.     public function getEvents(): Collection
  151.     {
  152.         return $this->events;
  153.     }
  154.     public function addEvent(Event $event): self
  155.     {
  156.         if (!$this->events->contains($event)) {
  157.             $this->events[] = $event;
  158.             $event->setAgency($this);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeEvent(Event $event): self
  163.     {
  164.         if ($this->events->removeElement($event)) {
  165.             // set the owning side to null (unless already changed)
  166.             if ($event->getAgency() === $this) {
  167.                 $event->setAgency(null);
  168.             }
  169.         }
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return Collection<int, History>
  174.      */
  175.     public function getHistories(): Collection
  176.     {
  177.         return $this->histories;
  178.     }
  179.     public function addHistory(History $history): self
  180.     {
  181.         if (!$this->histories->contains($history)) {
  182.             $this->histories[] = $history;
  183.             $history->setAgency($this);
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeHistory(History $history): self
  188.     {
  189.         if ($this->histories->removeElement($history)) {
  190.             // set the owning side to null (unless already changed)
  191.             if ($history->getAgency() === $this) {
  192.                 $history->setAgency(null);
  193.             }
  194.         }
  195.         return $this;
  196.     }
  197.     /**
  198.      * @return Collection<int, Order>
  199.      */
  200.     public function getOrders(): Collection
  201.     {
  202.         return $this->orders;
  203.     }
  204.     public function addOrder(Order $order): self
  205.     {
  206.         if (!$this->orders->contains($order)) {
  207.             $this->orders[] = $order;
  208.             $order->setAgency($this);
  209.         }
  210.         return $this;
  211.     }
  212.     public function removeOrder(Order $order): self
  213.     {
  214.         if ($this->orders->removeElement($order)) {
  215.             // set the owning side to null (unless already changed)
  216.             if ($order->getAgency() === $this) {
  217.                 $order->setAgency(null);
  218.             }
  219.         }
  220.         return $this;
  221.     }
  222. }