for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\Entity;
use App\Entity\Traits\EntityIdTrait;
use App\Entity\Traits\EntityNameTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
* @UniqueEntity("slug")
*/
class Category
{
use EntityIdTrait;
use EntityNameTrait;
* @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="category")
private $properties;
public function __construct()
$this->properties = new ArrayCollection();
}
public function getProperties(): Collection
return $this->properties;
public function addProperty(Property $property): self
if (!$this->properties->contains($property)) {
$this->properties[] = $property;
$property->setCategory($this);
return $this;
public function removeProperty(Property $property): self
if ($this->properties->contains($property)) {
$this->properties->removeElement($property);
// set the owning side to null (unless already changed)
if ($property->getCategory() === $this) {
$property->setCategory(null);