Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is it possible to generate a single entity from database using the Symfony2 console tool?

In the middle of coding I had to add a table and there are modifications made to the existing entity classes. So I don't want all my entities regenerated.

Any suggestions will be appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
366 views
Welcome To Ask or Share your Answers For Others

1 Answer

I had the same problem, you've to do this way:

php app/console doctrine:mapping:convert metadata_format 
    ./src/App/MyBundle/Resources/config/doctrine 
    --from-database 
    --filter="Yourtablename"

Then

php app/console doctrine:mapping:import AppMyBundle 
    metadata_format --filter="Yourtablename"

Where metadata_format is the file ending you want to generate (e.g. xml, yml, annotation)

And finally

php app/console doctrine:generate:entities AppMyBundle --no-backup

Like this doctrine will load only the entity you need. Just be carefull on the filter you must use the CamelCase !

Hope this will help you


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...