A simple working solution for annotating Symfony 2.7 parameters and for [/ xml / yml] see http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html
complete 3 commands in 3 steps:
$ php app/console doctrine:mapping:import --force AppBundle xml --filter="Meeting"
( NOTE: if your database name is my_meeting you will need to change it to MyMeeting in filter="MyMeeting" for the doctrine to find the name of your table. This is because the doctrine will always underline and add a cale to your table name. If not, you will get this error: "There is no matching information in the database.")
$ php app/console doctrine:mapping:convert annotation ./src/AppBundle/Entity --from-database --filter="Meeting"
( NOTE: make sure you have the namespace AppBundle\Entity; as shown below in the Meeting.php file, for example:
<?php namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM;
If not add it.)
Where:
- AppBundle is exactly your "AppBundle" in Symfony 2.7
- Meeting - Target Table (Camel Sensitive)
MAKE SURE check this directory:
CSI \ AppBundle / Resources / Configuration / Doctrine / Meeting.orm.xml
AND MAKE SURE that you only have .xml files for the table in which you want to create entity class files, while others do not. Then run this command below to generate the get and set methods for your entity class that you created earlier
$ php app / console doctrine: generate: entity AppBundle: Meeting --no-backup
Note 2: As a last step, you should remove the xml doctrine of the orm db file, for example, src\AppBundle/Resources/config/doctrine/VisitorData.orm.xml
This works very well for me.
For explanation, read: http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html
Dung Aug 14 '15 at 5:46 2015-08-14 05:46
source share