Jed
Jed

Reputation: 1043

Doctrine Exclude Tables from entity generation

I have a database that I want to create entities only for the tables with ax_ appended onto the front of it.

I have search everywhere are cant find any explanations.

php app/console doctrine:mapping:import --force AxxessORMBundle yml

This is the command I am using to create my entities

Upvotes: 3

Views: 3354

Answers (2)

qooplmao
qooplmao

Reputation: 17759

Looking at the code for ImportMappingDoctrineCommand there is a filter option

->addOption(
    'filter', 
    null, 
    InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 
    'A string pattern used to match entities that should be mapped.'
)

which I think you would be able to add your ax_.

This answer (paraphrased) says to convert and then import like so..

Convert

php app/console doctrine:mapping:convert xml
    ./src/Axxess/ORMBundle/Resources/config/doctrine/metadata/orm 
    --from-database --force

Import

php app/console doctrine:mapping:import AxxessORMBundle yml --filter="ax_"

Upvotes: 0

Jed
Jed

Reputation: 1043

This will filter out the ax_ tables

schema_filter: ~^(?!ax_)~

I am however wanting to only use the ax_ tables

Upvotes: 2

Related Questions