src/Entity/VendorContactPersons.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VendorContactPersonsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=VendorContactPersonsRepository::class)
  11.  * @UniqueEntity(
  12.  *     fields={"name", "surname", "vendor"},
  13.  *     message="Vendor Contact person already registered|Vendor contact person with combination (%s %s %s) is already registered"
  14.  * )
  15.  */
  16. class VendorContactPersons
  17. {
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      * @Groups({
  23.      *     "vendor_contact_person@base",
  24.      *     "vendor_contact_person@core"
  25.      * })
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=64)
  30.      * @Groups({
  31.      *      "vendor_contact_person@base",
  32.      *      "vendor_contact_person@core"
  33.      *  })
  34.      */
  35.     private $name;
  36.     /**
  37.      * @ORM\Column(type="string", length=64)
  38.      * @Groups({
  39.      *      "vendor_contact_person@base",
  40.      *      "vendor_contact_person@core"
  41.      *  })
  42.      */
  43.     private $surname;
  44.     /**
  45.      * @ORM\Column(type="string", length=64, nullable=true)
  46.      * @Groups({
  47.      *      "vendor_contact_person@core"
  48.      *  })
  49.      */
  50.     private $tel;
  51.     /**
  52.      * @ORM\Column(type="string", length=64, nullable=true)
  53.      * @Groups({
  54.      *       "vendor_contact_person@core"
  55.      *   })
  56.      */
  57.     private $email;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity=Vendor::class, inversedBy="contact_persons")
  60.      * @ORM\JoinColumn(nullable=false)
  61.      */
  62.     private $vendor;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=ProjectOrderTaskFulfillment::class, mappedBy="vendor_contact_person")
  65.      */
  66.     private $project_order_task_fulfillments;
  67.     /**
  68.      * @ORM\Column(type="string", length=64, nullable=true)
  69.      * @Groups({
  70.      *        "vendor_contact_person@core"
  71.      *    })
  72.      */
  73.     private $position;
  74.     public function __construct()
  75.     {
  76.         $this->project_order_task_fulfillments = new ArrayCollection();
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getName(): ?string
  83.     {
  84.         return $this->name;
  85.     }
  86.     public function setName(string $name): self
  87.     {
  88.         $this->name $name;
  89.         return $this;
  90.     }
  91.     public function getSurname(): ?string
  92.     {
  93.         return $this->surname;
  94.     }
  95.     public function setSurname(string $surname): self
  96.     {
  97.         $this->surname $surname;
  98.         return $this;
  99.     }
  100.     public function getTel(): ?string
  101.     {
  102.         return $this->tel;
  103.     }
  104.     public function setTel(?string $tel): self
  105.     {
  106.         $this->tel $tel;
  107.         return $this;
  108.     }
  109.     public function getEmail(): ?string
  110.     {
  111.         return $this->email;
  112.     }
  113.     public function setEmail(?string $email): self
  114.     {
  115.         $this->email $email;
  116.         return $this;
  117.     }
  118.     public function getVendor(): ?Vendor
  119.     {
  120.         return $this->vendor;
  121.     }
  122.     public function setVendor(?Vendor $vendor): self
  123.     {
  124.         $this->vendor $vendor;
  125.         return $this;
  126.     }
  127.     /**
  128.      * @return Collection<int, ProjectOrderTaskFulfillment>
  129.      */
  130.     public function getProjectOrderTaskFulfillments(): Collection
  131.     {
  132.         return $this->project_order_task_fulfillments;
  133.     }
  134.     public function addProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  135.     {
  136.         if (!$this->project_order_task_fulfillments->contains($projectOrderTaskFulfillment)) {
  137.             $this->project_order_task_fulfillments[] = $projectOrderTaskFulfillment;
  138.             $projectOrderTaskFulfillment->setVendorContactPerson($this);
  139.         }
  140.         return $this;
  141.     }
  142.     public function removeProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  143.     {
  144.         if ($this->project_order_task_fulfillments->removeElement($projectOrderTaskFulfillment)) {
  145.             // set the owning side to null (unless already changed)
  146.             if ($projectOrderTaskFulfillment->getVendorContactPerson() === $this) {
  147.                 $projectOrderTaskFulfillment->setVendorContactPerson(null);
  148.             }
  149.         }
  150.         return $this;
  151.     }
  152.     public function getPosition(): ?string
  153.     {
  154.         return $this->position;
  155.     }
  156.     public function setPosition(?string $position): self
  157.     {
  158.         $this->position $position;
  159.         return $this;
  160.     }
  161. }