src/Entity/Enterprise.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\isActif;
  4. use App\Repository\EnterpriseRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass=EnterpriseRepository::class)
  11.  * @UniqueEntity("slug")
  12.  */
  13. class Enterprise
  14. {
  15.     use isActif;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $lastname_la;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $firstname_la;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $adress;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      */
  41.     private $city;
  42.     /**
  43.      * @ORM\Column(type="integer")
  44.      */
  45.     private $postal_code;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      */
  49.     private $country;
  50.     /**
  51.      * @ORM\Column(type="string", length=255)
  52.      */
  53.     private $siret;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, nullable=true)
  56.      */
  57.     private $email;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      */
  61.     private $phone;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="enterprise")
  64.      */
  65.     private $users;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity=Contract::class, mappedBy="enterprise")
  68.      */
  69.     private $contracts;
  70.     /**
  71.      * @ORM\ManyToMany(targetEntity=Equipment::class, mappedBy="enterprise")
  72.      */
  73.     private $equipment;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity=EnterpriseHasEquipment::class, mappedBy="enterprise", cascade={"persist"})
  76.      */
  77.     private $equipments;
  78.     /**
  79.      * @ORM\OneToMany(targetEntity=Ticket::class, mappedBy="enterprise")
  80.      */
  81.     private $tickets;
  82.     /**
  83.      * @ORM\Column(type="string", length=255, unique=true)
  84.      */
  85.     private $slug;
  86.     /**
  87.      * @ORM\OneToMany(targetEntity=Abonnement::class, mappedBy="enterprise")
  88.      */
  89.     private $abonnements;
  90.     /**
  91.      * @ORM\Column(type="string", length=255, nullable=true)
  92.      */
  93.     private $stripeCustomerId;
  94.     public function __construct()
  95.     {
  96.         $this->users = new ArrayCollection();
  97.         $this->contracts = new ArrayCollection();
  98.         $this->equipment = new ArrayCollection();
  99.         $this->equipments = new ArrayCollection();
  100.         $this->tickets = new ArrayCollection();
  101.         $this->abonnements = new ArrayCollection();
  102.     }
  103.     public function getId(): ?int
  104.     {
  105.         return $this->id;
  106.     }
  107.     public function getName(): ?string
  108.     {
  109.         return $this->name;
  110.     }
  111.     public function setName(string $name): self
  112.     {
  113.         $this->name $name;
  114.         return $this;
  115.     }
  116.     public function getLastnameLa(): ?string
  117.     {
  118.         return $this->lastname_la;
  119.     }
  120.     public function setLastnameLa(string $lastname_la): self
  121.     {
  122.         $this->lastname_la $lastname_la;
  123.         return $this;
  124.     }
  125.     public function getFirstnameLa(): ?string
  126.     {
  127.         return $this->firstname_la;
  128.     }
  129.     public function setFirstnameLa(string $firstname_la): self
  130.     {
  131.         $this->firstname_la $firstname_la;
  132.         return $this;
  133.     }
  134.     public function getAdress(): ?string
  135.     {
  136.         return $this->adress;
  137.     }
  138.     public function setAdress(string $adress): self
  139.     {
  140.         $this->adress $adress;
  141.         return $this;
  142.     }
  143.     public function getCity(): ?string
  144.     {
  145.         return $this->city;
  146.     }
  147.     public function setCity(string $city): self
  148.     {
  149.         $this->city $city;
  150.         return $this;
  151.     }
  152.     public function getPostalCode(): ?int
  153.     {
  154.         return $this->postal_code;
  155.     }
  156.     public function setPostalCode(int $postal_code): self
  157.     {
  158.         $this->postal_code $postal_code;
  159.         return $this;
  160.     }
  161.     public function getCountry(): ?string
  162.     {
  163.         return $this->country;
  164.     }
  165.     public function setCountry(string $country): self
  166.     {
  167.         $this->country $country;
  168.         return $this;
  169.     }
  170.     public function getSiret(): ?string
  171.     {
  172.         return $this->siret;
  173.     }
  174.     public function setSiret(string $siret): self
  175.     {
  176.         $this->siret $siret;
  177.         return $this;
  178.     }
  179.     public function getEmail(): ?string
  180.     {
  181.         return $this->email;
  182.     }
  183.     public function setEmail(?string $email): self
  184.     {
  185.         $this->email $email;
  186.         return $this;
  187.     }
  188.     public function getPhone(): ?string
  189.     {
  190.         return $this->phone;
  191.     }
  192.     public function setPhone(?string $phone): self
  193.     {
  194.         $this->phone $phone;
  195.         return $this;
  196.     }
  197.     /**
  198.      * @return Collection|User[]
  199.      */
  200.     public function getUsers(): Collection
  201.     {
  202.         return $this->users;
  203.     }
  204.     public function addUser(User $user): self
  205.     {
  206.         if (! $this->users->contains($user)) {
  207.             $this->users[] = $user;
  208.             $user->setEnterprise($this);
  209.         }
  210.         return $this;
  211.     }
  212.     public function removeUser(User $user): self
  213.     {
  214.         if ($this->users->removeElement($user)) {
  215.             // set the owning side to null (unless already changed)
  216.             if ($user->getEnterprise() === $this) {
  217.                 $user->setEnterprise(null);
  218.             }
  219.         }
  220.         return $this;
  221.     }
  222.     /**
  223.      * @return Collection|Contract[]
  224.      */
  225.     public function getContracts(): Collection
  226.     {
  227.         return $this->contracts;
  228.     }
  229.     public function addContract(Contract $contract): self
  230.     {
  231.         if (! $this->contracts->contains($contract)) {
  232.             $this->contracts[] = $contract;
  233.             $contract->setEnterprise($this);
  234.         }
  235.         return $this;
  236.     }
  237.     public function removeContract(Contract $contract): self
  238.     {
  239.         if ($this->contracts->removeElement($contract)) {
  240.             // set the owning side to null (unless already changed)
  241.             if ($contract->getEnterprise() === $this) {
  242.                 $contract->setEnterprise(null);
  243.             }
  244.         }
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return Collection|Equipment[]
  249.      */
  250.     public function getEquipment(): Collection
  251.     {
  252.         return $this->equipment;
  253.     }
  254.     public function addEquipment(EnterpriseHasEquipment $equipment): self
  255.     {
  256.         if (! $this->equipments->contains($equipment)) {
  257.             $this->equipments[] = $equipment;
  258.             $equipment->setEnterprise($this);
  259.         }
  260.         return $this;
  261.     }
  262.     public function removeEquipment(Equipment $equipment): self
  263.     {
  264.         if ($this->equipment->removeElement($equipment)) {
  265.             $equipment->removeEnterprise($this);
  266.         }
  267.         return $this;
  268.     }
  269.     /**
  270.      * @return Collection|EnterpriseHasEquipment[]
  271.      */
  272.     public function getEquipments(): Collection
  273.     {
  274.         return $this->equipments;
  275.     }
  276.     public function __toString(): string
  277.     {
  278.         return $this->getName();
  279.     }
  280.     /**
  281.      * @return Collection|Ticket[]
  282.      */
  283.     public function getTickets(): Collection
  284.     {
  285.         return $this->tickets;
  286.     }
  287.     public function addTicket(Ticket $ticket): self
  288.     {
  289.         if (! $this->tickets->contains($ticket)) {
  290.             $this->tickets[] = $ticket;
  291.             $ticket->setEnterprise($this);
  292.         }
  293.         return $this;
  294.     }
  295.     public function removeTicket(Ticket $ticket): self
  296.     {
  297.         if ($this->tickets->removeElement($ticket)) {
  298.             // set the owning side to null (unless already changed)
  299.             if ($ticket->getEnterprise() === $this) {
  300.                 $ticket->setEnterprise(null);
  301.             }
  302.         }
  303.         return $this;
  304.     }
  305.     public function getSlug(): ?string
  306.     {
  307.         return $this->slug;
  308.     }
  309.     public function setSlug(string $slug): self
  310.     {
  311.         $this->slug $slug;
  312.         return $this;
  313.     }
  314.     /**
  315.      * @return Collection|Abonnement[]
  316.      */
  317.     public function getAbonnements(): ?Collection
  318.     {
  319.         return $this->abonnements;
  320.     }
  321.     public function addAbonnement(Abonnement $abonnement): self
  322.     {
  323.         if (! $this->abonnements->contains($abonnement)) {
  324.             $this->abonnements[] = $abonnement;
  325.             $abonnement->setEnterprise($this);
  326.         }
  327.         return $this;
  328.     }
  329.     public function removeAbonnement(Abonnement $abonnement): self
  330.     {
  331.         if ($this->abonnements->removeElement($abonnement)) {
  332.             // set the owning side to null (unless already changed)
  333.             if ($abonnement->getEnterprise() === $this) {
  334.                 $abonnement->setEnterprise(null);
  335.             }
  336.         }
  337.         return $this;
  338.     }
  339.     public function getStripeCustomerId(): ?string
  340.     {
  341.         return $this->stripeCustomerId;
  342.     }
  343.     public function setStripeCustomerId(?string $stripeCustomerId): self
  344.     {
  345.         $this->stripeCustomerId $stripeCustomerId;
  346.         return $this;
  347.     }
  348. }