<?php
|
declare(strict_types=1);
|
|
namespace App\Entity;
|
|
use App\Enum\LabelType;
|
use App\Repository\OustedLabelRepository;
|
use Doctrine\ORM\Mapping as ORM;
|
|
#[ORM\Entity(repositoryClass: OustedLabelRepository::class)]
|
#[ORM\UniqueConstraint(name: 'ousted_label_book_type_label', columns: ['book_id', 'type', 'label'])]
|
class OustedLabel extends AbstractLabel {
|
#[ORM\ManyToOne(targetEntity: OustedBook::class, inversedBy: 'labels')]
|
#[ORM\JoinColumn(nullable: false)]
|
private OustedBook $book;
|
|
public function __construct(OustedBook $book, string $label, LabelType $type = LabelType::TEXT) {
|
parent::__construct($label, $type);
|
$this->book = $book;
|
}
|
|
public function getBook(): OustedBook {
|
return $this->book;
|
}
|
}
|