You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an entity uses a trait that itself also uses a trait with a doctrine annotation the mapper failes to recognize the imported annotation. Code example below if it's not clear.
Q
A
BC Break
no
Version
1.6.1
How to reproduce
Create the following class and traits using doctrine/orm:
Trying to create a mapping for this setup will throw an AnnotationException:
[Semantical Error] The annotation "@Column" in property Search\Model\ClassA::$column was never imported. Did you maybe forget to add a "use" statement for this annotation?
This will fail on any Doctrine annotation that is used in TraitB but not imported in TraitA or ClassA.
I expect the @Column-annotation imported in TraitB to stay also be valid for ClassA where it ends up in.
The text was updated successfully, but these errors were encountered:
Having the same issue (in my case with Gedmo). Cannot use a basic fixer PhpCsFixer\Fixer\Import\NoUnusedImportsFixer because of it. Problem does not exist when annotation is imported inside first level trait.
I put this comment in my class to be able to import Gedmo without PHPCS error :
/**
* @phpstan-ignore-next-line
*
* Use Gedmo var to be able to import it due to issue with Doctrine Annnotations and Traits
*
* @see https://github.com/doctrine/annotations/issues/268
*
* @var Gedmo
*/
So my class is like this :
<?phpdeclare(strict_types=1);
namespaceApp\EntityuseDoctrine\ORM\MappingasORM;
useGedmo\Mapping\AnnotationasGedmo;
/** * @ORM\Entity * @ORM\Table(name="app_myentity") */class MyEntity implements MyEntityInterface
{
/** * @phpstan-ignore-next-line * * Use Gedmo var to be able to import it due to issue with Doctrine Annnotations and Traits * * @see https://github.com/doctrine/annotations/issues/268 * * @var Gedmo */use MyEntityTrait;
}
Bug Report
When an entity uses a trait that itself also uses a trait with a doctrine annotation the mapper failes to recognize the imported annotation. Code example below if it's not clear.
How to reproduce
Create the following class and traits using doctrine/orm:
Trying to create a mapping for this setup will throw an
AnnotationException
:This will fail on any Doctrine annotation that is used in
TraitB
but not imported inTraitA
orClassA
.I expect the
@Column
-annotation imported inTraitB
to stay also be valid forClassA
where it ends up in.The text was updated successfully, but these errors were encountered: