-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEntityInheritance_MappedSuperclassEntity.php
More file actions
34 lines (29 loc) · 1.14 KB
/
EntityInheritance_MappedSuperclassEntity.php
File metadata and controls
34 lines (29 loc) · 1.14 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
<?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;
/**
* An entity extending a mapped superclass, adding Polyglot support. The full Polyglot
* configuration — including marking the inherited property for translation via
* the class-level #[TranslatedProperty] attribute — lives here.
*/
#[Polyglot\Locale(primary: 'en_GB')]
#[Polyglot\TranslatedProperty('text')]
#[ORM\Entity]
class EntityInheritance_MappedSuperclassEntity extends EntityInheritance_MappedSuperclass
{
#[Polyglot\TranslationCollection]
#[ORM\OneToMany(targetEntity: EntityInheritance_MappedSuperclassEntityTranslation::class, mappedBy: 'entity')]
private Collection $translations;
public function __construct()
{
$this->translations = new ArrayCollection();
}
public function setText(TranslatableInterface $text): void
{
$this->text = $text;
}
}