<?php
namespace App\Entity;
use App\Repository\AlbumPhotoRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AlbumPhotoRepository::class)]
class AlbumPhoto
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\OneToMany(mappedBy: 'album', targetEntity: PhotoGalery::class)]
private Collection $photoGaleries;
public function __construct()
{
$this->photoGaleries = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, PhotoGalery>
*/
public function getPhotoGaleries(): Collection
{
return $this->photoGaleries;
}
public function addPhotoGalery(PhotoGalery $photoGalery): static
{
if (!$this->photoGaleries->contains($photoGalery)) {
$this->photoGaleries->add($photoGalery);
$photoGalery->setAlbum($this);
}
return $this;
}
public function removePhotoGalery(PhotoGalery $photoGalery): static
{
if ($this->photoGaleries->removeElement($photoGalery)) {
// set the owning side to null (unless already changed)
if ($photoGalery->getAlbum() === $this) {
$photoGalery->setAlbum(null);
}
}
return $this;
}
}