<?phpnamespace App\Entity;use App\Annotation\SiteAware;use App\Entity\Garages\GarageGroup;use App\Entity\Interfaces\SiteInterface;use App\Entity\Traits\NameTrait;use App\Entity\Traits\SiteTrait;use App\Repository\ProvinceRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Table(name="vulco_province", indexes={@ORM\Index(name="slider_province_site_idx", columns={"site"})}) * @ORM\Entity(repositoryClass=ProvinceRepository::class) * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false) * @SiteAware(siteFieldName="site") */class Province extends AbstractBase implements SiteInterface{ use SiteTrait; use NameTrait; /** * @ORM\Column(type="string", length=255, nullable=false) */ private string $name; /** * @ORM\ManyToMany(targetEntity="App\Entity\Garages\GarageGroup", mappedBy="provinces") */ private ?Collection $garageGroups; /** * @ORM\ManyToOne(targetEntity="App\Entity\Region", fetch="EAGER") */ private ?Region $region = null; public function __construct() { $this->garageGroups = new ArrayCollection(); } public function __clone() { if ($this->id) { if (!is_null($this->garageGroups)) { $this->garageGroups = clone $this->garageGroups; } } } public function getGarageGroups(): ?Collection { return $this->garageGroups; } public function setGarageGroups(?Collection $garageGroups): self { $this->garageGroups = $garageGroups; return $this; } public function addGarageGroup(GarageGroup $garageGroup): self { if (!$this->garageGroups->contains($garageGroup)) { $this->garageGroups->add($garageGroup); } return $this; } public function removeGarageGroup(GarageGroup $garageGroup): self { if ($this->garageGroups->contains($garageGroup)) { $this->garageGroups->removeElement($garageGroup); } return $this; } public function getRegion(): ?Region { return $this->region; } public function setRegion(?Region $region): self { $this->region = $region; return $this; } public function diff(Province $province): bool { if ( ($this->name !== $province->name) ) { return true; } return false; } public function __toString(): string { return $this->id ? $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING; }}