src/Entity/Vendor.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VendorRepository;
  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=VendorRepository::class)
  11.  * @ORM\Table(
  12.  *     name="vendor",
  13.  *     uniqueConstraints={
  14.  *          @ORM\UniqueConstraint(columns={"tax_number", "name"})
  15.  *     }
  16.  * )
  17.  * @UniqueEntity(
  18.  *     fields={"tax_number", "name"},
  19.  *     message="Vendor already registered|Vendor with name (%s) is already registered"
  20.  * )
  21.  */
  22. class Vendor
  23. {
  24.     /**
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue
  27.      * @ORM\Column(type="integer")
  28.      * @Groups({
  29.      *     "vendor@base",
  30.      *     "vendor@core"
  31.      * })
  32.      */
  33.     private $id;
  34.     /**
  35.      * @ORM\Column(type="string", length=64)
  36.      * @Groups({
  37.      *      "vendor@base",
  38.      *      "vendor@core"
  39.      *  })
  40.      */
  41.     private $name;
  42.     /**
  43.      * @ORM\Column(type="string", length=64, nullable=true)
  44.      * @Groups({
  45.      *      "vendor@core"
  46.      *  })
  47.      */
  48.     private $tax_number;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="vendors")
  51.      * @Groups({
  52.      *       "vendor@country"
  53.      *   })
  54.      */
  55.     private $country;
  56.     /**
  57.      * @ORM\Column(type="string", length=64, nullable=true)
  58.      * @Groups({
  59.      *       "vendor@core"
  60.      *   })
  61.      */
  62.     private $tel;
  63.     /**
  64.      * @ORM\Column(type="string", length=64, nullable=true)
  65.      * @Groups({
  66.      *       "vendor@core"
  67.      *   })
  68.      */
  69.     private $email;
  70.     /**
  71.      * doctrine.yaml&Doctrine/Type/VendorTypeEnum
  72.      * @ORM\Column(type="vendor_type", nullable=true)
  73.      * @Groups({
  74.      *       "vendor@core"
  75.      *   })
  76.      */
  77.     private $vendor_type;
  78.     /**
  79.      * doctrine.yaml&Doctrine/Type/VendorStatusEnum
  80.      * @ORM\Column(type="vendor_status", nullable=true)
  81.      * @Groups({
  82.      *       "vendor@core"
  83.      *   })
  84.      */
  85.     private $vendor_status;
  86.     /**
  87.      * @ORM\Column(type="string", length=1000, nullable=true)
  88.      * @Groups({
  89.      *     "vendor@core"
  90.      * })
  91.      */
  92.     private $vendor_logo;
  93.     /**
  94.      * cascade Remove Ever vendor silinirse hepsini sil
  95.      * orphan removal ise ->removeElement in calisabilmesi icin
  96.      * @ORM\OneToMany(targetEntity=VendorContactPersons::class, mappedBy="vendor", cascade={"persist", "remove"}, orphanRemoval=true )
  97.      * @Groups({
  98.      *      "vendor@contact_persons"
  99.      *  })
  100.      */
  101.     private $contact_persons;
  102.     /**
  103.      * @ORM\OneToMany(targetEntity=ProjectOrderTaskFulfillment::class, mappedBy="vendor")
  104.      */
  105.     private $project_order_task_fulfillments;
  106.     public function __construct()
  107.     {
  108.         $this->contact_persons = new ArrayCollection();
  109.         $this->project_order_task_fulfillments = new ArrayCollection();
  110.     }
  111.     public function getId(): ?int
  112.     {
  113.         return $this->id;
  114.     }
  115.     public function getName(): ?string
  116.     {
  117.         return $this->name;
  118.     }
  119.     public function setName(string $name): self
  120.     {
  121.         $this->name $name;
  122.         return $this;
  123.     }
  124.     public function getTaxNumber(): ?string
  125.     {
  126.         return $this->tax_number;
  127.     }
  128.     public function setTaxNumber(?string $tax_number): self
  129.     {
  130.         $this->tax_number $tax_number;
  131.         return $this;
  132.     }
  133.     public function getCountry(): ?Countries
  134.     {
  135.         return $this->country;
  136.     }
  137.     public function setCountry(?Countries $country): self
  138.     {
  139.         $this->country $country;
  140.         return $this;
  141.     }
  142.     public function getTel(): ?string
  143.     {
  144.         return $this->tel;
  145.     }
  146.     public function setTel(?string $tel): self
  147.     {
  148.         $this->tel $tel;
  149.         return $this;
  150.     }
  151.     public function getEmail(): ?string
  152.     {
  153.         return $this->email;
  154.     }
  155.     public function setEmail(?string $email): self
  156.     {
  157.         $this->email $email;
  158.         return $this;
  159.     }
  160.     public function getVendorType(): ?string
  161.     {
  162.         return $this->vendor_type;
  163.     }
  164.     public function setVendorType(?string $vendor_type): self
  165.     {
  166.         $this->vendor_type $vendor_type;
  167.         return $this;
  168.     }
  169.     public function getVendorStatus(): ?string
  170.     {
  171.         return $this->vendor_status;
  172.     }
  173.     public function setVendorStatus(?string $vendor_status): self
  174.     {
  175.         $this->vendor_status $vendor_status;
  176.         return $this;
  177.     }
  178.     public function getVendorLogo(): ?string
  179.     {
  180.         return $this->vendor_logo;
  181.     }
  182.     public function setVendorLogo(?string $vendor_logo): self
  183.     {
  184.         $this->vendor_logo $vendor_logo;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @return Collection<int, VendorContactPersons>
  189.      */
  190.     public function getContactPersons(): Collection
  191.     {
  192.         return $this->contact_persons;
  193.     }
  194.     public function addContactPerson(VendorContactPersons $vendorContactPerson): self
  195.     {
  196.         if (!$this->contact_persons->contains($vendorContactPerson)) {
  197.             $this->contact_persons[] = $vendorContactPerson;
  198.             $vendorContactPerson->setVendor($this);
  199.         }
  200.         return $this;
  201.     }
  202.     public function removeContactPerson(VendorContactPersons $vendorContactPerson): self
  203.     {
  204.         if ($this->contact_persons->removeElement($vendorContactPerson)) {
  205.             // set the owning side to null (unless already changed)
  206.             if ($vendorContactPerson->getVendor() === $this) {
  207.                 $vendorContactPerson->setVendor(null);
  208.             }
  209.         }
  210.         return $this;
  211.     }
  212.     /**
  213.      * @return Collection<int, ProjectOrderTaskFulfillment>
  214.      */
  215.     public function getProjectOrderTaskFulfillments(): Collection
  216.     {
  217.         return $this->project_order_task_fulfillments;
  218.     }
  219.     public function addProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  220.     {
  221.         if (!$this->project_order_task_fulfillments->contains($projectOrderTaskFulfillment)) {
  222.             $this->project_order_task_fulfillments[] = $projectOrderTaskFulfillment;
  223.             $projectOrderTaskFulfillment->setVendor($this);
  224.         }
  225.         return $this;
  226.     }
  227.     public function removeProjectOrderTaskFulfillment(ProjectOrderTaskFulfillment $projectOrderTaskFulfillment): self
  228.     {
  229.         if ($this->project_order_task_fulfillments->removeElement($projectOrderTaskFulfillment)) {
  230.             // set the owning side to null (unless already changed)
  231.             if ($projectOrderTaskFulfillment->getVendor() === $this) {
  232.                 $projectOrderTaskFulfillment->setVendor(null);
  233.             }
  234.         }
  235.         return $this;
  236.     }
  237. }