-
-
Notifications
You must be signed in to change notification settings - Fork 955
Closed
Description
API Platform version(s) affected: 2.5.0
Description
Inheritance of Serializer @groups or @ApiProperty items seems not to be honoured when extending classes or adding Traits to a class.
How to reproduce
Example class:
/**
* @ORM\MappedSuperclass()
* @ORM\HasLifecycleCallbacks()
*/
abstract class BaseEntity
{
/**
* @ApiProperty()
* @ORM\Column(type="datetime")
* @Groups({"base:internal"})
*/
private $created;
/**
* @ApiProperty()
* @ORM\Column(type="datetime")
* @Groups({"base:internal"})
*/
private $modified;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @Groups({"base:internal"})
*/
private $creator;
...
}
Classes extending this one have correct fields in Doctrine, but the ApiPlatform Groups and other annotations in ApiProperty are not honored.
The same happens if I add properties and getters/setters via a a corresponding Trait, e.g.
/**
* Trait TimeStampedEntityTrait
* @package App\Entity
*/
trait TimeStampedEntityTrait
{
/**
* @ORM\Column(type="datetime")
* @Groups({"base:internal"})
*/
private $created;
/**
* @ApiProperty()
* @ORM\Column(type="datetime")
* @Groups({"base:internal"})
*/
private $modified;
...
}
I would expect the annotations to be carried on into all children.
Metadata
Metadata
Assignees
Labels
No labels