Skip to content

Commit ca1a738

Browse files
authored
Support Doctrine attributes alongside annotations in BaseTranslation (#44)
This PR adds Doctrine attributes to the MappedSuperclass `BaseTranslation` while keeping the annotations in place. This allows `BaseTranslation` to be used with either annotations or attribute-based Doctrine configurations.
1 parent e310121 commit ca1a738

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Entity/BaseTranslation.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/**
1717
* @ORM\MappedSuperclass
1818
*/
19+
#[ORM\MappedSuperclass]
1920
class BaseTranslation
2021
{
2122
/**
@@ -25,6 +26,9 @@ class BaseTranslation
2526
*
2627
* @ORM\Column(type="integer")
2728
*/
29+
#[ORM\Id]
30+
#[ORM\GeneratedValue]
31+
#[ORM\Column(type: 'integer')]
2832
protected $id;
2933

3034
/**
@@ -33,11 +37,13 @@ class BaseTranslation
3337
* @PolyglotAnnotation\Locale
3438
*/
3539
#[Polyglot\Locale]
40+
#[ORM\Column]
3641
protected $locale;
3742

3843
/**
3944
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id", nullable=false)
4045
*/
46+
#[ORM\JoinColumn(name: 'entity_id', referencedColumnName: 'id', nullable: false)]
4147
protected $entity;
4248

4349
public function getLocale()

0 commit comments

Comments
 (0)