JustinP
JustinP

Reputation: 1401

Symfony Generating Specific Entities from the Database

I have a larger database and I'd like to create entities for 4 tables. I'v been referencing this Symfony Cookbook but it's not help quite getting me where I want to be.

Step 1 - Import From Database

php app/console doctrine:mapping:import --force AcmeBlogBundle xml

Question Here: Can you import specific tables? or all tables that start with 'Abc%'?) What command would do this?

Step 2 - Convert the import to Annotaction|Yml|XML

php app/console doctrine:mapping:convert annotation ./src

Problem here: Even if I delete the imported files and leave the specific orm.xml I'm interested in, they still seem to affect this command. Is there a cache to clear or something??

Step 3 -- Create the Entities

php app/console doctrine:generate:entities AcmeBlogBundle

I haven't had any problems here.. However, getting to this point requires creating and deleting a lot of unnecessary files which is a real headache from a version control perspective.

Upvotes: 1

Views: 995

Answers (1)

Javad
Javad

Reputation: 4397

I think the steps should be done in below arrange and you need to use --filter for the specific table:

Step1

php app/console doctrine:mapping:convert annotation  /src/App/MyBundle/Resources/config/doctrine --from-database --filter="table_name"

Step2 Now you can apply importing

php app/console doctrine:mapping:import AppMyBundle annotation --filter="table_name"

Step3

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

Upvotes: 1

Related Questions