38 lines
885 B
PHP
38 lines
885 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity]
|
|
#[ORM\Table(name: 'document_tag')]
|
|
class DocumentTag
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\ManyToOne(targetEntity: Document::class, inversedBy: 'documentTags')]
|
|
#[ORM\JoinColumn(name: 'document_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
|
|
private Document $document;
|
|
|
|
#[ORM\Id]
|
|
#[ORM\ManyToOne(targetEntity: Tag::class)]
|
|
#[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
|
|
private Tag $tag;
|
|
|
|
public function __construct(Document $document, Tag $tag)
|
|
{
|
|
$this->document = $document;
|
|
$this->tag = $tag;
|
|
}
|
|
|
|
public function getDocument(): Document
|
|
{
|
|
return $this->document;
|
|
}
|
|
|
|
public function getTag(): Tag
|
|
{
|
|
return $this->tag;
|
|
}
|
|
} |