src/Entity/Corporation.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\CorporationRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\UX\Turbo\Attribute\Broadcast;
  10. #[ORM\Entity(repositoryClassCorporationRepository::class)]
  11. #[Broadcast]
  12. #[ApiResource]
  13. class Corporation
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $name null;
  21.     #[ORM\Column(typeTypes::TEXT)]
  22.     private ?string $description null;
  23.     #[ORM\Embedded(class: Adress::class)]
  24.     private Adress $adress;
  25.     #[ORM\Embedded(class: Adress::class)]
  26.     private Adress $billingAdress;
  27.     #[ORM\OneToMany(mappedBy'corporation'targetEntityCorporationContact::class)]
  28.     private Collection $corporationContacts;
  29.     #[ORM\OneToMany(mappedBy'corporation'targetEntityAttendee::class)]
  30.     private Collection $attendees;
  31.     #[ORM\OneToMany(mappedBy'corporation'targetEntityPortal::class)]
  32.     private Collection $portals;
  33.     #[ORM\OneToMany(mappedBy'corporation'targetEntityDepartment::class)]
  34.     private Collection $departments;
  35.     #[ORM\Column(length255)]
  36.     private ?string $CorporationType null;
  37.     #[ORM\OneToMany(mappedBy'corporation'targetEntityPortalAdministrator::class)]
  38.     private Collection $portalAdministrators;
  39.     #[ORM\OneToMany(mappedBy'customer'targetEntityPromo::class)]
  40.     private Collection $promos;
  41.     #[ORM\OneToMany(mappedBy'corporation'targetEntityCorporationDiscount::class)]
  42.     private Collection $corporationDiscounts;
  43.     public function __construct()
  44.     {
  45.         $this->adress = new Adress();
  46.         $this->billingAdress = new Adress();
  47.         $this->corporationContacts = new ArrayCollection();
  48.         $this->attendees = new ArrayCollection();
  49.         $this->portals = new ArrayCollection();
  50.         $this->departments = new ArrayCollection();
  51.         $this->portalAdministrators = new ArrayCollection();
  52.         $this->promos = new ArrayCollection();
  53.         $this->corporationDiscounts = new ArrayCollection();
  54.     }
  55.     public function __toString(): string
  56.     {
  57.         return $this->name;
  58.     }
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function getName(): ?string
  64.     {
  65.         return $this->name;
  66.     }
  67.     public function setName(string $name): self
  68.     {
  69.         $this->name $name;
  70.         return $this;
  71.     }
  72.     public function getDescription(): ?string
  73.     {
  74.         return $this->description;
  75.     }
  76.     public function setDescription(string $description): self
  77.     {
  78.         $this->description $description;
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return Adress
  83.      */
  84.     public function getAdress(): Adress
  85.     {
  86.         return $this->adress;
  87.     }
  88.     /**
  89.      * @param Adress $adress
  90.      * @return Corporation
  91.      */
  92.     public function setAdress(Adress $adress): Corporation
  93.     {
  94.         $this->adress $adress;
  95.         return $this;
  96.     }
  97.     /**
  98.      * @return Adress
  99.      */
  100.     public function getBillingAdress(): Adress
  101.     {
  102.         return $this->billingAdress;
  103.     }
  104.     /**
  105.      * @param Adress $billingAdress
  106.      * @return Corporation
  107.      */
  108.     public function setBillingAdress(Adress $billingAdress): Corporation
  109.     {
  110.         $this->billingAdress $billingAdress;
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, CorporationContact>
  115.      */
  116.     public function getCorporationContacts(): Collection
  117.     {
  118.         return $this->corporationContacts;
  119.     }
  120.     public function addCorporationContact(CorporationContact $corporationContact): self
  121.     {
  122.         if (!$this->corporationContacts->contains($corporationContact)) {
  123.             $this->corporationContacts->add($corporationContact);
  124.             $corporationContact->setCorporation($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeCorporationContact(CorporationContact $corporationContact): self
  129.     {
  130.         if ($this->corporationContacts->removeElement($corporationContact)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($corporationContact->getCorporation() === $this) {
  133.                 $corporationContact->setCorporation(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection<int, Attendee>
  140.      */
  141.     public function getAttendees(): Collection
  142.     {
  143.         return $this->attendees;
  144.     }
  145.     public function addAttendee(Attendee $attendee): self
  146.     {
  147.         if (!$this->attendees->contains($attendee)) {
  148.             $this->attendees->add($attendee);
  149.             $attendee->setCorporation($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeAttendee(Attendee $attendee): self
  154.     {
  155.         if ($this->attendees->removeElement($attendee)) {
  156.             // set the owning side to null (unless already changed)
  157.             if ($attendee->getCorporation() === $this) {
  158.                 $attendee->setCorporation(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, Portal>
  165.      */
  166.     public function getPortals(): Collection
  167.     {
  168.         return $this->portals;
  169.     }
  170.     public function addPortal(Portal $portal): self
  171.     {
  172.         if (!$this->portals->contains($portal)) {
  173.             $this->portals->add($portal);
  174.             $portal->setCorporation($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removePortal(Portal $portal): self
  179.     {
  180.         if ($this->portals->removeElement($portal)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($portal->getCorporation() === $this) {
  183.                 $portal->setCorporation(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, Department>
  190.      */
  191.     public function getDepartments(): Collection
  192.     {
  193.         return $this->departments;
  194.     }
  195.     public function addDepartment(Department $department): self
  196.     {
  197.         if (!$this->departments->contains($department)) {
  198.             $this->departments->add($department);
  199.             $department->setCorporation($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeDepartment(Department $department): self
  204.     {
  205.         if ($this->departments->removeElement($department)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($department->getCorporation() === $this) {
  208.                 $department->setCorporation(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213.     public function getCorporationType(): ?string
  214.     {
  215.         return $this->CorporationType;
  216.     }
  217.     public function setCorporationType(string $CorporationType): self
  218.     {
  219.         $this->CorporationType $CorporationType;
  220.         return $this;
  221.     }
  222.     /**
  223.      * @return Collection<int, PortalAdministrator>
  224.      */
  225.     public function getPortalAdministrators(): Collection
  226.     {
  227.         return $this->portalAdministrators;
  228.     }
  229.     public function addPortalAdministrator(PortalAdministrator $portalAdministrator): self
  230.     {
  231.         if (!$this->portalAdministrators->contains($portalAdministrator)) {
  232.             $this->portalAdministrators->add($portalAdministrator);
  233.             $portalAdministrator->setCorporation($this);
  234.         }
  235.         return $this;
  236.     }
  237.     public function removePortalAdministrator(PortalAdministrator $portalAdministrator): self
  238.     {
  239.         if ($this->portalAdministrators->removeElement($portalAdministrator)) {
  240.             // set the owning side to null (unless already changed)
  241.             if ($portalAdministrator->getCorporation() === $this) {
  242.                 $portalAdministrator->setCorporation(null);
  243.             }
  244.         }
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return Collection<int, Promo>
  249.      */
  250.     public function getPromos(): Collection
  251.     {
  252.         return $this->promos;
  253.     }
  254.     public function addPromo(Promo $promo): self
  255.     {
  256.         if (!$this->promos->contains($promo)) {
  257.             $this->promos->add($promo);
  258.             $promo->setCustomer($this);
  259.         }
  260.         return $this;
  261.     }
  262.     public function removePromo(Promo $promo): self
  263.     {
  264.         if ($this->promos->removeElement($promo)) {
  265.             // set the owning side to null (unless already changed)
  266.             if ($promo->getCustomer() === $this) {
  267.                 $promo->setCustomer(null);
  268.             }
  269.         }
  270.         return $this;
  271.     }
  272.     /**
  273.      * @return Collection<int, CorporationDiscount>
  274.      */
  275.     public function getCorporationDiscounts(): Collection
  276.     {
  277.         return $this->corporationDiscounts;
  278.     }
  279.     public function addCorporationDiscount(CorporationDiscount $corporationDiscount): self
  280.     {
  281.         if (!$this->corporationDiscounts->contains($corporationDiscount)) {
  282.             $this->corporationDiscounts->add($corporationDiscount);
  283.             $corporationDiscount->setCorporation($this);
  284.         }
  285.         return $this;
  286.     }
  287.     public function removeCorporationDiscount(CorporationDiscount $corporationDiscount): self
  288.     {
  289.         if ($this->corporationDiscounts->removeElement($corporationDiscount)) {
  290.             // set the owning side to null (unless already changed)
  291.             if ($corporationDiscount->getCorporation() === $this) {
  292.                 $corporationDiscount->setCorporation(null);
  293.             }
  294.         }
  295.         return $this;
  296.     }
  297. }