<?php
namespace App\Entity;
use App\Repository\VendorContactPersonsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=VendorContactPersonsRepository::class)
* @UniqueEntity(
* fields={"name", "surname", "vendor"},
* message="Vendor Contact person already registered|Vendor contact person with combination (%s %s %s) is already registered"
* )
*/
class VendorContactPersons
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "vendor_contact_person@base",
* "vendor_contact_person@core"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "vendor_contact_person@base",
* "vendor_contact_person@core"
* })
*/
private $name;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "vendor_contact_person@base",
* "vendor_contact_person@core"
* })
*/
private $surname;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({
* "vendor_contact_person@core"
* })
*/
private $tel;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({
* "vendor_contact_person@core"
* })
*/
private $email;
/**
* @ORM\ManyToOne(targetEntity=Vendor::class, inversedBy="contact_persons")
* @ORM\JoinColumn(nullable=false)
*/
private $vendor;
/**
* @ORM\OneToMany(targetEntity=ProjectOrderTaskFulfillment::class, mappedBy="vendor_contact_person")
*/
private $project_order_task_fulfillments;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({
* "vendor_contact_person@core"
* })
*/
private $position;
public function __construct()
{
$this->project_order_task_fulfillments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSurname(): ?string
{
return $this->surname;
}
public function setSurname(string $surname): self
{
$this->surname = $surname;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(?string $tel): self
{
$this->tel = $tel;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getVendor(): ?Vendor
{
return $this->vendor;
}
public function setVendor(?Vendor $vendor): self
{
$this->vendor = $vendor;
return $this;
}
/**
* @return Collection<int, ProjectOrderTaskFulfillment>
*/
public function getProjectOrderTaskFulfillments(): Collection
{
return $this->project_order_task_fulfillments;
}
public function addProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
{
if (!$this->project_order_task_fulfillments->contains($projectOrderTaskFulfillment)) {
$this->project_order_task_fulfillments[] = $projectOrderTaskFulfillment;
$projectOrderTaskFulfillment->setVendorContactPerson($this);
}
return $this;
}
public function removeProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
{
if ($this->project_order_task_fulfillments->removeElement($projectOrderTaskFulfillment)) {
// set the owning side to null (unless already changed)
if ($projectOrderTaskFulfillment->getVendorContactPerson() === $this) {
$projectOrderTaskFulfillment->setVendorContactPerson(null);
}
}
return $this;
}
public function getPosition(): ?string
{
return $this->position;
}
public function setPosition(?string $position): self
{
$this->position = $position;
return $this;
}
}