You can clone with
today I updated from sf2 b1 to b2 SE and updated to the master branch.
Of cause I read about the changed use of annotations in the update file and modified my creation script.
But now I can't generate my entities based on the database anymore.
The following command is executed like expected and generates all the entity files in my projects entity folder:
php app/console doctrine:mapping:import "MyXBundle" annotation --em=withport;
This command fails with the following error message:
php app/console doctrine:generate:entities MyXBundle/Entity;
[Semantical Error] The annotation "@orm:Table" in class My\XBundle\Entity\XY was never imported.
The doctrine:mapping:import command still generates old syntax entities.
Thanks for looking into this,
This is a known issue, but a Doctrine one. The Doctrine command is not updated yet. Ping @beberlei.
Changing the prefix from orm: to orm\ is a symfony issue though. The generator is only missing to generate the use statement then.
Well, DoctrineBundle could be changed to set orm\ as prefix of the annotations but this would not solve the issue that the use statement is not set by the EntityGenerator (and the prefix to use depends of the way the statement is written).
I have already removed the prefix in beta2. So, as soon as Doctrine adds the required use statements, it will work.
@fabpot Removing the prefix entirely means that the use statement is needed for all annotations used in the class (which depends of the mapping). It would be better to set the prefix to ORM\ in the EntityGenerator which will allow to use a single use statement
I just submitted a PR to update the EntityGenerator: doctrine/doctrine2#61
Just as a note until this is fixed and for anyone that bumps into this issue and its not as obvious to fix, just:
0) Import your schema using annotations, i.e. app/console doctrine:mapping:import "MyTestBundle" annotation
1) Add use Doctrine\ORM\Mapping as ORM; before the annotated class
2) Find and replace @orm: to @ORM\
3) Run import command as usual
app/console doctrine:mapping:import "MyTestBundle" annotation
use Doctrine\ORM\Mapping as ORM;
Doctrine PR61 has been merged into master. So, as soon as it is also merged into the 2.0.x branch and if a new 2.0 version is released, it will fix this bug automatically. So, I"m closing the issue.
For others running into this problem, it seems that running app/console doctrine:mapping:import "MyTestBundle" annotation followed by app/console doctrine:generate:entities "MyTestBundle" still does not work in the Symfony Standard 2.0 RC1 edition (where no prefix at all is being added to the annotations).
app/console doctrine:generate:entities "MyTestBundle"
Setting the annotation prefix in ImportMapingDoctrineCommand.php like 94b0a01 seems to fix the problem.