<?php
namespace App\Entity;
use App\Repository\InvoiceTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=InvoiceTypeRepository::class)
*/
class InvoiceType
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "invoice.type.base",
* "project.details",
* "project.details.orders",
* "order.detail"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "invoice.type.base",
* "project.details",
* "project.details.orders",
* "order.detail"
* })
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $description;
/**
* @ORM\OneToMany(targetEntity=ProjectOrders::class, mappedBy="invoice_type")
*/
private $projectOrders;
/**
* @ORM\OneToMany(targetEntity=Projects::class, mappedBy="invoice_type")
*/
private $projects;
public function __construct()
{
$this->projectOrders = new ArrayCollection();
$this->projects = 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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, ProjectOrders>
*/
public function getProjectOrders(): Collection
{
return $this->projectOrders;
}
public function addProjectOrder(ProjectOrders $projectOrder): self
{
if (!$this->projectOrders->contains($projectOrder)) {
$this->projectOrders[] = $projectOrder;
$projectOrder->setInvoiceType($this);
}
return $this;
}
public function removeProjectOrder(ProjectOrders $projectOrder): self
{
if ($this->projectOrders->removeElement($projectOrder)) {
// set the owning side to null (unless already changed)
if ($projectOrder->getInvoiceType() === $this) {
$projectOrder->setInvoiceType(null);
}
}
return $this;
}
/**
* @return Collection<int, Projects>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Projects $project): self
{
if (!$this->projects->contains($project)) {
$this->projects[] = $project;
$project->setInvoiceType($this);
}
return $this;
}
public function removeProject(Projects $project): self
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getInvoiceType() === $this) {
$project->setInvoiceType(null);
}
}
return $this;
}
}