src/Entity/Sponsor.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SponsorRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Uid\Uuid;
  8. #[ORM\Entity(repositoryClassSponsorRepository::class)]
  9. class Sponsor
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(type'uuid'uniquetrue)]
  16.     private ?string $uuid null;
  17.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Person $person null;
  20.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  21.     #[ORM\JoinColumn(nullablefalse)]
  22.     private ?Address $address null;
  23.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?Contact $contact null;
  26.     #[ORM\OneToMany(mappedBy'sponsor'targetEntityCustomerAdvertisingArea::class, cascade: ['persist'])]
  27.     private Collection $areas;
  28.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'sponsor')]
  29.     #[ORM\JoinColumn(name'fk_customer'nullablefalse)]
  30.     private ?Customer $customer null;
  31.     #[ORM\Column]
  32.     private ?\DateTimeImmutable $createdAt null;
  33.     #[ORM\OneToMany(mappedBy'sponsor'targetEntityContract::class, cascade: ['persist''remove'])]
  34.     #[ORM\OrderBy(["id" => "DESC"])]
  35.     private ?Collection $contracts;
  36.     #[ORM\ManyToOne(cascade: ['persist''remove'])]
  37.     #[ORM\JoinColumn(nullabletrue)]
  38.     private ?Image $image null;
  39.     public function __construct()
  40.     {
  41.         $this->areas = new ArrayCollection();
  42.         $this->contracts = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getCreatedAt(): ?\DateTimeImmutable
  49.     {
  50.         return $this->createdAt;
  51.     }
  52.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  53.     {
  54.         $this->createdAt $createdAt;
  55.         return $this;
  56.     }
  57.     public function getPerson(): ?Person
  58.     {
  59.         return $this->person;
  60.     }
  61.     public function setPerson(Person $person): self
  62.     {
  63.         $this->person $person;
  64.         return $this;
  65.     }
  66.     public function getAddress(): ?Address
  67.     {
  68.         return $this->address;
  69.     }
  70.     public function setAddress(Address $address): self
  71.     {
  72.         $this->address $address;
  73.         return $this;
  74.     }
  75.     public function getContact(): ?Contact
  76.     {
  77.         return $this->contact;
  78.     }
  79.     public function setContact(Contact $contact): self
  80.     {
  81.         $this->contact $contact;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, CustomerAdvertisingArea>
  86.      */
  87.     public function getAreas(): Collection
  88.     {
  89.         return $this->areas;
  90.     }
  91.     public function addCustomerAdvertisingArea(CustomerAdvertisingArea $customerAdvertisingArea): self
  92.     {
  93.         if (!$this->areas->contains($customerAdvertisingArea)) {
  94.             $this->areas->add($customerAdvertisingArea);
  95.             $customerAdvertisingArea->setSponsor($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeCustomerAdvertisingArea(CustomerAdvertisingArea $customerAdvertisingArea): self
  100.     {
  101.         if ($this->areas->removeElement($customerAdvertisingArea)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($customerAdvertisingArea->getSponsor() === $this) {
  104.                 $customerAdvertisingArea->setSponsor(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     public function getCustomer(): ?Customer
  110.     {
  111.         return $this->customer;
  112.     }
  113.     public function setCustomer(?Customer $customer): self
  114.     {
  115.         $this->customer $customer;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, Contract>
  120.      */
  121.     public function getContracts(): Collection
  122.     {
  123.         return $this->contracts;
  124.     }
  125.     public function addContract(Contract $contract): self
  126.     {
  127.         if (!$this->contracts->contains($contract)) {
  128.             $this->contracts->add($contract);
  129.             $contract->setSponsor($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeContract(Contract $contract): self
  134.     {
  135.         if ($this->contracts->removeElement($contract)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($contract->getSponsor() === $this) {
  138.                 $contract->setSponsor(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     public function getImage(): ?Image
  144.     {
  145.         return $this->image;
  146.     }
  147.     public function setImage(?Image $image): self
  148.     {
  149.         $this->image $image;
  150.         return $this;
  151.     }
  152.     public function addArea(CustomerAdvertisingArea $area): self
  153.     {
  154.         if (!$this->areas->contains($area)) {
  155.             $this->areas->add($area);
  156.             $area->setSponsor($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeArea(CustomerAdvertisingArea $area): self
  161.     {
  162.         if ($this->areas->removeElement($area)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($area->getSponsor() === $this) {
  165.                 $area->setSponsor(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     public function getUuid(): ?string
  171.     {
  172.         return $this->uuid;
  173.     }
  174.     public function setUuid(Uuid $uuid): self
  175.     {
  176.         $this->uuid $uuid;
  177.         return $this;
  178.     }
  179. }