Open davidrojo opened 4 years ago
API Platform version(s) affected: 2.5.6
Description When having a trait inside an entity, if you use @var File then ApiPlatform tries to load the entity from App\Entities\File instead of the FQN defined in the use statement.
@var File
App\Entities\File
How to reproduce With the sample code of Api/platform (https://api-platform.com/docs/distribution/#installing-the-framework)
Create a file src/Entity/FileTrait.php
src/Entity/FileTrait.php
<?php namespace App\Entity; use Symfony\Component\HttpFoundation\File\File; trait FileTrait { /** @var File */ public $file; }
Modify src/Entity/Greetings.php and add:
src/Entity/Greetings.php
class Greetings { ... use FileTrait; ... }
When doing this accessing localhost:8443 you will receive the error "Class App\Entity\File does not exist"
localhost:8443
Class App\Entity\File does not exist
If you change in "FileTrait" the var with the FQN of the File class, it works fine
/** @var \Symfony\Component\HttpFoundation\File\File */ public $file;
related to https://github.com/api-platform/core/issues/3349 AFAIU
API Platform version(s) affected: 2.5.6
Description
When having a trait inside an entity, if you use
@var File
then ApiPlatform tries to load the entity fromApp\Entities\File
instead of the FQN defined in the use statement.How to reproduce
With the sample code of Api/platform (https://api-platform.com/docs/distribution/#installing-the-framework)
Create a file
src/Entity/FileTrait.php
Modify
src/Entity/Greetings.php
and add:When doing this accessing
localhost:8443
you will receive the error "Class App\Entity\File does not exist
"If you change in "FileTrait" the var with the FQN of the File class, it works fine