src/Entity/BrandLogo.php line 12
<?phpnamespace App\Entity;use App\Repository\BrandLogoRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: BrandLogoRepository::class)]#[ORM\HasLifecycleCallbacks]class BrandLogo{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $brand_logo_image = null;#[ORM\OneToMany(mappedBy: 'brand_logo', targetEntity: Brand::class)]private Collection $brands;public function __construct(){$this->brands = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getBrandLogoImage(): ?string{return $this->brand_logo_image;}public function setBrandLogoImage(string $brand_logo_image): self{$this->brand_logo_image = $brand_logo_image;return $this;}/*** @return Collection<int, Brand>*/public function getBrands(): Collection{return $this->brands;}public function addBrand(Brand $brand): self{if (!$this->brands->contains($brand)) {$this->brands->add($brand);$brand->setBrandLogo($this);}return $this;}public function removeBrand(Brand $brand): self{if ($this->brands->removeElement($brand)) {// set the owning side to null (unless already changed)if ($brand->getBrandLogo() === $this) {$brand->setBrandLogo(null);}}return $this;}#[ORM\PreRemove]public function preRemove(): void{$imagePath = 'assets/img/brand/' . $this->getBrandLogoImage();if (file_exists($imagePath)) {unlink($imagePath);}}public function __toString(): string{return $this->brand_logo_image;}}