Using PHP 7 and the Doctrine Group

I want to use some functions of PHP 7, but I’m kind of struggling with it.

I have a Symfony-Project using Doctrine to display some Entities. New in PHP 7 are the GROUP USE-Statemens that I wanted to try. But it seems like I'm doing something wrong, since Symfony / Doctrine cannot resolve annotations in an Entity-Object.

Use expression:

use Doctrine\ORM\Mapping\{Entity, Id, Table, Column, GeneratedValue, JoinColumn, OneToOne, ManyToMany, JoinTable};

Entity

/**
 * @Entity
 * @Table(name="expansion")
 */
class Expansion {
..
}

Exception

[Semantical Error] The annotation "@Entity" in class AppBundle\Entity\Expansion was never imported. Did you maybe forget to add a "use" statement for this annotation?

If I use single USE-Statement, the import works fine ...

What am I doing wrong? The versions are correct. PHPStorm also says that "Alias ​​XY" is never used.

Thanks for your support!

+4
source share
1 answer

100%, , Doctrine\Common\Annotations PHP7 use. , , Doctrine\Common\Annotations\TokenParser::parseUseStatement, , .

+5

Source: https://habr.com/ru/post/1624180/


All Articles