<?php
namespace App\Entity;
use App\Repository\AlbumRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AlbumRepository::class)
*/
class Album
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cover;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $status;
/**
* @ORM\ManyToOne(targetEntity=Service::class, inversedBy="albums")
*/
private $service;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $createdAt;
/**
* @ORM\OneToMany(targetEntity=Portfolio::class, mappedBy="album")
*/
private $portfolios;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $shootedAt;
public function __construct()
{
$this->portfolios = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getCover(): ?string
{
return $this->cover;
}
public function setCover(?string $cover): self
{
$this->cover = $cover;
return $this;
}
public function isStatus(): ?bool
{
return $this->status;
}
public function setStatus(?bool $status): self
{
$this->status = $status;
return $this;
}
public function getService(): ?Service
{
return $this->service;
}
public function setService(?Service $service): self
{
$this->service = $service;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection<int, Portfolio>
*/
public function getPortfolios(): Collection
{
return $this->portfolios;
}
public function addPortfolio(Portfolio $portfolio): self
{
if (!$this->portfolios->contains($portfolio)) {
$this->portfolios[] = $portfolio;
$portfolio->setAlbum($this);
}
return $this;
}
public function removePortfolio(Portfolio $portfolio): self
{
if ($this->portfolios->removeElement($portfolio)) {
// set the owning side to null (unless already changed)
if ($portfolio->getAlbum() === $this) {
$portfolio->setAlbum(null);
}
}
return $this;
}
public function getShootedAt(): ?\DateTimeImmutable
{
return $this->shootedAt;
}
public function setShootedAt(?\DateTimeImmutable $shootedAt): self
{
$this->shootedAt = $shootedAt;
return $this;
}
public function __toString(): string
{
return $this->title ?: 'Album';
}
}