Flumzi/src/Entity/ReleaseMetadata.php
dece 0c17bbbc4c Add ReleaseMetadata entity
Why ReleaseMetadata and not simply Metadata you ask? Because I want to
be sure future entities may have their own type of metadata and not have
name conflicts.

Why not adding this data to Release? I don't know, I like small tables
for the main entities I guess, probably #DoesNotScale.
2023-10-01 15:17:06 +02:00

58 lines
1.2 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\ReleaseMetadataRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* Metadata related to a release.
*
* Could be pulled from an external source (MusicBrainz, Discogs, …) or filled by hand. A release should be usable
* without associated metadata, but these metadata should always have a 1-1 relation to an existing release.
*/
#[ORM\Entity(repositoryClass: ReleaseMetadataRepository::class)]
class ReleaseMetadata
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\OneToOne(inversedBy: 'metadata', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?Release $release = null;
#[ORM\Column(nullable: true)]
private ?int $year = null;
public function getId(): ?int
{
return $this->id;
}
public function getRelease(): ?Release
{
return $this->release;
}
public function setRelease(Release $release): static
{
$this->release = $release;
return $this;
}
public function getYear(): ?int
{
return $this->year;
}
public function setYear(?int $year): static
{
$this->year = $year;
return $this;
}
}