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.     /**
  75.      * K7 (2026-08-10) — Faz 2 hazirligi: dis firma yetkilisi ERP'ye AYRI login ile
  76.      * girecegi zaman bu FK ile eslenir. Faz 1'de doldurulmaz (dis firma login'i YOK,
  77.      * bkz. MODULE_SPECS/TaskExecution-Flow.md §6). Bilerek nullable + kullanilmiyor.
  78.      * @ORM\ManyToOne(targetEntity=User::class)
  79.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  80.      * @Groups({
  81.      *     "vendor_contact_person@user"
  82.      * })
  83.      */
  84.     private $user;
  85.     public function __construct()
  86.     {
  87.         $this->project_order_task_fulfillments = 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 getSurname(): ?string
  103.     {
  104.         return $this->surname;
  105.     }
  106.     public function setSurname(string $surname): self
  107.     {
  108.         $this->surname $surname;
  109.         return $this;
  110.     }
  111.     public function getTel(): ?string
  112.     {
  113.         return $this->tel;
  114.     }
  115.     public function setTel(?string $tel): self
  116.     {
  117.         $this->tel $tel;
  118.         return $this;
  119.     }
  120.     public function getEmail(): ?string
  121.     {
  122.         return $this->email;
  123.     }
  124.     public function setEmail(?string $email): self
  125.     {
  126.         $this->email $email;
  127.         return $this;
  128.     }
  129.     public function getVendor(): ?Vendor
  130.     {
  131.         return $this->vendor;
  132.     }
  133.     public function setVendor(?Vendor $vendor): self
  134.     {
  135.         $this->vendor $vendor;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection<int, ProjectOrderTaskFulfillment>
  140.      */
  141.     public function getProjectOrderTaskFulfillments(): Collection
  142.     {
  143.         return $this->project_order_task_fulfillments;
  144.     }
  145.     public function addProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  146.     {
  147.         if (!$this->project_order_task_fulfillments->contains($projectOrderTaskFulfillment)) {
  148.             $this->project_order_task_fulfillments[] = $projectOrderTaskFulfillment;
  149.             $projectOrderTaskFulfillment->setVendorContactPerson($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  154.     {
  155.         if ($this->project_order_task_fulfillments->removeElement($projectOrderTaskFulfillment)) {
  156.             // set the owning side to null (unless already changed)
  157.             if ($projectOrderTaskFulfillment->getVendorContactPerson() === $this) {
  158.                 $projectOrderTaskFulfillment->setVendorContactPerson(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     public function getPosition(): ?string
  164.     {
  165.         return $this->position;
  166.     }
  167.     public function setPosition(?string $position): self
  168.     {
  169.         $this->position $position;
  170.         return $this;
  171.     }
  172.     public function getUser(): ?User
  173.     {
  174.         return $this->user;
  175.     }
  176.     public function setUser(?User $user): self
  177.     {
  178.         $this->user $user;
  179.         return $this;
  180.     }
  181. }