-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEntityInheritance_BaseEntityClass.php
More file actions
52 lines (42 loc) · 1.45 KB
/
EntityInheritance_BaseEntityClass.php
File metadata and controls
52 lines (42 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Webfactory\Bundle\PolyglotBundle\Tests\Fixtures\Entity\EntityInheritance;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Webfactory\Bundle\PolyglotBundle\Attribute as Polyglot;
use Webfactory\Bundle\PolyglotBundle\TranslatableInterface;
#[Polyglot\Locale(primary: 'en_GB')]
#[ORM\Entity]
#[ORM\InheritanceType(value: 'SINGLE_TABLE')]
#[ORM\DiscriminatorMap(['base' => 'EntityInheritance_BaseEntityClass', 'child' => 'EntityInheritance_ChildEntityClass'])]
#[ORM\DiscriminatorColumn(name: 'discriminator', type: 'string')]
class EntityInheritance_BaseEntityClass
{
#[ORM\Column(type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $id = null;
private string $discriminator;
#[Polyglot\TranslationCollection]
#[ORM\OneToMany(targetEntity: EntityInheritance_BaseEntityClassTranslation::class, mappedBy: 'entity')]
private Collection $translations;
#[Polyglot\Translatable]
#[ORM\Column(type: 'string')]
private TranslatableInterface|string|null $text = null;
public function __construct()
{
$this->translations = new ArrayCollection();
}
public function getId(): int
{
return $this->id;
}
public function setText(TranslatableInterface $text): void
{
$this->text = $text;
}
public function getText(): TranslatableInterface
{
return $this->text;
}
}