add tagging
This commit is contained in:
38
src/Entity/DocumentTag.php
Normal file
38
src/Entity/DocumentTag.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user