<?php
namespace App\Entity;
use App\Repository\XeroTrackingCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: XeroTrackingCategoryRepository::class)]
class XeroTrackingCategory
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $name;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $xeroId;
#[ORM\OneToMany(mappedBy: 'xeroTrackingCategory', targetEntity: XeroTrackingOption::class)]
private $xeroTrackingOptions;
public function __construct()
{
$this->xeroTrackingOptions = 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 getXeroId(): ?string
{
return $this->xeroId;
}
public function setXeroId(?string $xeroId): self
{
$this->xeroId = $xeroId;
return $this;
}
/**
* @return Collection<int, XeroTrackingOption>
*/
public function getXeroTrackingOptions(): Collection
{
return $this->xeroTrackingOptions;
}
public function addXeroTrackingOption(XeroTrackingOption $xeroTrackingOption): self
{
if (!$this->xeroTrackingOptions->contains($xeroTrackingOption)) {
$this->xeroTrackingOptions[] = $xeroTrackingOption;
$xeroTrackingOption->setXeroTrackingCategory($this);
}
return $this;
}
public function removeXeroTrackingOption(XeroTrackingOption $xeroTrackingOption): self
{
if ($this->xeroTrackingOptions->removeElement($xeroTrackingOption)) {
// set the owning side to null (unless already changed)
if ($xeroTrackingOption->getXeroTrackingCategory() === $this) {
$xeroTrackingOption->setXeroTrackingCategory(null);
}
}
return $this;
}
}