src/Entity/Provider.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\isActif;
  4. use App\Entity\Trait\isTimestamstable;
  5. use App\Repository\ProviderRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. /**
  11.  * @ORM\Entity(repositoryClass=ProviderRepository::class)
  12.  * @ORM\HasLifecycleCallbacks
  13.  * @UniqueEntity("slug")
  14.  */
  15. class Provider
  16. {
  17.     use isActif;
  18.     use isTimestamstable;
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      */
  28.     private $name;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $lastname_la;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $firstname_la;
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      */
  40.     private $adress;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $city;
  45.     /**
  46.      * @ORM\Column(type="integer")
  47.      */
  48.     private $postal_code;
  49.     /**
  50.      * @ORM\Column(type="string", length=255, nullable=true)
  51.      */
  52.     private $phone;
  53.     /**
  54.      * @ORM\Column(type="string", length=255, nullable=true)
  55.      */
  56.     private $email;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity=Collect::class, mappedBy="provider")
  59.      */
  60.     private $collects;
  61.     /**
  62.      * @ORM\ManyToMany(targetEntity=Contract::class, mappedBy="providers")
  63.      */
  64.     private $contracts;
  65.     /**
  66.      * @ORM\ManyToMany(targetEntity=Equipment::class, mappedBy="provider")
  67.      */
  68.     private $equipment;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=ProviderHasEquipment::class, mappedBy="provider", cascade={"persist"})
  71.      */
  72.     private $equipments;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=Ticket::class, mappedBy="provider")
  75.      */
  76.     private $tickets;
  77.     /**
  78.      * @ORM\Column(type="string", length=255, unique=true)
  79.      */
  80.     private $slug;
  81.     public function __construct()
  82.     {
  83.         $this->collects = new ArrayCollection();
  84.         $this->contracts = new ArrayCollection();
  85.         $this->equipment = new ArrayCollection();
  86.         $this->equipments = new ArrayCollection();
  87.         $this->tickets = new ArrayCollection();
  88.     }
  89.     public function getId(): ?int
  90.     {
  91.         return $this->id;
  92.     }
  93.     public function getName(): ?string
  94.     {
  95.         return $this->name;
  96.     }
  97.     public function setName(string $name): self
  98.     {
  99.         $this->name $name;
  100.         return $this;
  101.     }
  102.     public function getLastnameLa(): ?string
  103.     {
  104.         return $this->lastname_la;
  105.     }
  106.     public function setLastnameLa(string $lastname_la): self
  107.     {
  108.         $this->lastname_la $lastname_la;
  109.         return $this;
  110.     }
  111.     public function getFirstnameLa(): ?string
  112.     {
  113.         return $this->firstname_la;
  114.     }
  115.     public function setFirstnameLa(string $firstname_la): self
  116.     {
  117.         $this->firstname_la $firstname_la;
  118.         return $this;
  119.     }
  120.     public function getAdress(): ?string
  121.     {
  122.         return $this->adress;
  123.     }
  124.     public function setAdress(string $adress): self
  125.     {
  126.         $this->adress $adress;
  127.         return $this;
  128.     }
  129.     public function getCity(): ?string
  130.     {
  131.         return $this->city;
  132.     }
  133.     public function setCity(string $city): self
  134.     {
  135.         $this->city $city;
  136.         return $this;
  137.     }
  138.     public function getPostalCode(): ?int
  139.     {
  140.         return $this->postal_code;
  141.     }
  142.     public function setPostalCode(int $postal_code): self
  143.     {
  144.         $this->postal_code $postal_code;
  145.         return $this;
  146.     }
  147.     public function getPhone(): ?string
  148.     {
  149.         return $this->phone;
  150.     }
  151.     public function setPhone(?string $phone): self
  152.     {
  153.         $this->phone $phone;
  154.         return $this;
  155.     }
  156.     public function getEmail(): ?string
  157.     {
  158.         return $this->email;
  159.     }
  160.     public function setEmail(?string $email): self
  161.     {
  162.         $this->email $email;
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return Collection|Collect[]
  167.      */
  168.     public function getCollects(): Collection
  169.     {
  170.         return $this->collects;
  171.     }
  172.     public function addCollect(Collect $collect): self
  173.     {
  174.         if (! $this->collects->contains($collect)) {
  175.             $this->collects[] = $collect;
  176.             $collect->setProvider($this);
  177.         }
  178.         return $this;
  179.     }
  180.     public function removeCollect(Collect $collect): self
  181.     {
  182.         if ($this->collects->removeElement($collect)) {
  183.             // set the owning side to null (unless already changed)
  184.             if ($collect->getProvider() === $this) {
  185.                 $collect->setProvider(null);
  186.             }
  187.         }
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Collection|Contract[]
  192.      */
  193.     public function getContracts(): Collection
  194.     {
  195.         return $this->contracts;
  196.     }
  197.     public function addContract(Contract $contract): self
  198.     {
  199.         if (! $this->contracts->contains($contract)) {
  200.             $this->contracts[] = $contract;
  201.             $contract->addProvider($this);
  202.         }
  203.         return $this;
  204.     }
  205.     public function removeContract(Contract $contract): self
  206.     {
  207.         if ($this->contracts->removeElement($contract)) {
  208.             $contract->removeProvider($this);
  209.         }
  210.         return $this;
  211.     }
  212.     /**
  213.      * @return Collection|Equipment[]
  214.      */
  215.     public function getEquipment(): Collection
  216.     {
  217.         return $this->equipment;
  218.     }
  219.     public function addEquipment(ProviderHasEquipment $equipment): self
  220.     {
  221.         if (! $this->equipments->contains($equipment)) {
  222.             $this->equipments[] = $equipment;
  223.             $equipment->setProvider($this);
  224.         }
  225.         return $this;
  226.     }
  227.     public function removeEquipment(Equipment $equipment): self
  228.     {
  229.         if ($this->equipment->removeElement($equipment)) {
  230.             $equipment->removeProvider($this);
  231.         }
  232.         return $this;
  233.     }
  234.     /**
  235.      * @return Collection|ProviderHasEquipment[]
  236.      */
  237.     public function getEquipments(): Collection
  238.     {
  239.         return $this->equipments;
  240.     }
  241.     public function __toString(): string
  242.     {
  243.         return $this->getName();
  244.     }
  245.     /**
  246.      * @return Collection|Ticket[]
  247.      */
  248.     public function getTickets(): Collection
  249.     {
  250.         return $this->tickets;
  251.     }
  252.     public function addTicket(Ticket $ticket): self
  253.     {
  254.         if (! $this->tickets->contains($ticket)) {
  255.             $this->tickets[] = $ticket;
  256.             $ticket->setProvider($this);
  257.         }
  258.         return $this;
  259.     }
  260.     public function removeTicket(Ticket $ticket): self
  261.     {
  262.         if ($this->tickets->removeElement($ticket)) {
  263.             // set the owning side to null (unless already changed)
  264.             if ($ticket->getProvider() === $this) {
  265.                 $ticket->setProvider(null);
  266.             }
  267.         }
  268.         return $this;
  269.     }
  270.     public function getSlug(): ?string
  271.     {
  272.         return $this->slug;
  273.     }
  274.     public function setSlug(string $slug): self
  275.     {
  276.         $this->slug $slug;
  277.         return $this;
  278.     }
  279. }