src/Entity/InvoiceType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InvoiceTypeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=InvoiceTypeRepository::class)
  10.  */
  11. class InvoiceType
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({
  18.      *      "invoice.type.base",
  19.      *      "project.details",
  20.      *      "project.details.orders",
  21.      *      "order.detail"
  22.      * })
  23.      */ 
  24.     private $id;
  25.     
  26.     /**
  27.      * @ORM\Column(type="string", length=64)
  28.      * @Groups({
  29.      *      "invoice.type.base",
  30.      *      "project.details",
  31.      *      "project.details.orders",
  32.      *      "order.detail"
  33.      * })
  34.      */
  35.     private $name;
  36.     
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      */
  40.     private $description;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity=ProjectOrders::class, mappedBy="invoice_type")
  43.      */
  44.     private $projectOrders;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=Projects::class, mappedBy="invoice_type")
  47.      */
  48.     private $projects;
  49.     public function __construct()
  50.     {
  51.         $this->projectOrders = new ArrayCollection();
  52.         $this->projects = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getName(): ?string
  59.     {
  60.         return $this->name;
  61.     }
  62.     public function setName(string $name): self
  63.     {
  64.         $this->name $name;
  65.         return $this;
  66.     }
  67.     public function getDescription(): ?string
  68.     {
  69.         return $this->description;
  70.     }
  71.     public function setDescription(string $description): self
  72.     {
  73.         $this->description $description;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection<int, ProjectOrders>
  78.      */
  79.     public function getProjectOrders(): Collection
  80.     {
  81.         return $this->projectOrders;
  82.     }
  83.     public function addProjectOrder(ProjectOrders $projectOrder): self
  84.     {
  85.         if (!$this->projectOrders->contains($projectOrder)) {
  86.             $this->projectOrders[] = $projectOrder;
  87.             $projectOrder->setInvoiceType($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeProjectOrder(ProjectOrders $projectOrder): self
  92.     {
  93.         if ($this->projectOrders->removeElement($projectOrder)) {
  94.             // set the owning side to null (unless already changed)
  95.             if ($projectOrder->getInvoiceType() === $this) {
  96.                 $projectOrder->setInvoiceType(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, Projects>
  103.      */
  104.     public function getProjects(): Collection
  105.     {
  106.         return $this->projects;
  107.     }
  108.     public function addProject(Projects $project): self
  109.     {
  110.         if (!$this->projects->contains($project)) {
  111.             $this->projects[] = $project;
  112.             $project->setInvoiceType($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeProject(Projects $project): self
  117.     {
  118.         if ($this->projects->removeElement($project)) {
  119.             // set the owning side to null (unless already changed)
  120.             if ($project->getInvoiceType() === $this) {
  121.                 $project->setInvoiceType(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126. }