Skip to content

Commit

Permalink
Support Doctrine attributes alongside annotations in BaseTranslation (
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
relthyg authored Apr 4, 2024
1 parent e310121 commit ca1a738
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Entity/BaseTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/**
* @ORM\MappedSuperclass
*/
#[ORM\MappedSuperclass]
class BaseTranslation
{
/**
Expand All @@ -25,6 +26,9 @@ class BaseTranslation
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
Expand All @@ -33,11 +37,13 @@ class BaseTranslation
* @PolyglotAnnotation\Locale
*/
#[Polyglot\Locale]
#[ORM\Column]
protected $locale;

/**
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id", nullable=false)
*/
#[ORM\JoinColumn(name: 'entity_id', referencedColumnName: 'id', nullable: false)]
protected $entity;

public function getLocale()
Expand Down

0 comments on commit ca1a738

Please sign in to comment.