You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
1.7 KiB
86 lines
1.7 KiB
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\ReleaseRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: ReleaseRepository::class)]
|
|
class Release
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $title = null;
|
|
|
|
#[ORM\ManyToMany(targetEntity: Artist::class, inversedBy: 'releases')]
|
|
private Collection $artists;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'releases')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?User $owner = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->artists = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): static
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Artist>
|
|
*/
|
|
public function getArtists(): Collection
|
|
{
|
|
return $this->artists;
|
|
}
|
|
|
|
public function addArtist(Artist $artist): static
|
|
{
|
|
if (!$this->artists->contains($artist)) {
|
|
$this->artists->add($artist);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeArtist(Artist $artist): static
|
|
{
|
|
$this->artists->removeElement($artist);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getOwner(): ?User
|
|
{
|
|
return $this->owner;
|
|
}
|
|
|
|
public function setOwner(?User $owner): static
|
|
{
|
|
$this->owner = $owner;
|
|
|
|
return $this;
|
|
}
|
|
}
|