<?phpnamespace App\Entity\Website;use App\Entity\Website\Website\Website;use App\Repository\Website\CostCategoryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;use App\Entity\BaseEntity;#[ORM\Entity(repositoryClass: CostCategoryRepository::class)]class CostCategory extends BaseEntity{ #[ORM\Id] #[ORM\Column(type: 'guid', unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] private ?string $id = null; #[ORM\Column(length: 255)] private ?string $title = null; #[ORM\OneToMany(mappedBy: 'costCategory', targetEntity: Cost::class)] private Collection $costs; #[ORM\ManyToOne(inversedBy: 'costCategories')] #[ORM\JoinColumn(nullable: false)] private ?Website $website = null; public function __construct() { parent::__construct(); $this->costs = new ArrayCollection(); } public function __toString():string { return $this->getTitle(); } public function getId(): ?string { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): static { $this->title = $title; return $this; } /** * @return Collection<int, Cost> */ public function getCosts(): Collection { return $this->costs; } public function addCost(Cost $cost): static { if (!$this->costs->contains($cost)) { $this->costs->add($cost); $cost->setCostCategory($this); } return $this; } public function removeCost(Cost $cost): static { if ($this->costs->removeElement($cost)) { // set the owning side to null (unless already changed) if ($cost->getCostCategory() === $this) { $cost->setCostCategory(null); } } return $this; } public function getWebsite(): ?Website { return $this->website; } public function setWebsite(?Website $website): static { $this->website = $website; return $this; }}