summaryrefslogtreecommitdiff
path: root/src/Model/Card.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2022-01-16 12:22:04 +0100
committerDaniel Weipert <code@drogueronin.de>2022-01-16 12:22:04 +0100
commit8d58c7de92c75e826a8399ec7914b463f8916dcd (patch)
tree9663d390c7474c3a883438c16d7e0015c576cf04 /src/Model/Card.php
parent4cacc94240944ff316104bfd1b5e8e00fad14517 (diff)
Add categories for cards and relate them to meta
Diffstat (limited to 'src/Model/Card.php')
-rw-r--r--src/Model/Card.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Model/Card.php b/src/Model/Card.php
index 9707e16..abaa06e 100644
--- a/src/Model/Card.php
+++ b/src/Model/Card.php
@@ -9,6 +9,7 @@ use Doctrine\DBAL\Schema\Table;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
+use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\PersistentCollection;
use Elements\DB;
@@ -49,6 +50,12 @@ class Card
*/
public Collection|ArrayCollection|PersistentCollection $votes;
+ #[ManyToMany(targetEntity: Category::class, inversedBy: 'cards')]
+ /**
+ * @ManyToMany(targetEntity="Category", inversedBy="cards", cascade={"persist"})
+ */
+ public Collection|ArrayCollection|PersistentCollection $categories;
+
/**
* Card constructor.
*/
@@ -57,6 +64,7 @@ class Card
$this->meta = new ArrayCollection();
$this->artworks = new ArrayCollection();
$this->votes = new ArrayCollection();
+ $this->categories = new ArrayCollection();
}
/**