symfony - Importing tables from external database in Symfony2 with doctrine -


i have symfony2 project own database, , want connect database (another project) can modify tables.

i created new connection in config_dev.yml

doctrine:     dbal:         default_connection: default         connections:             default:                 driver:   pdo_mysql                 host:     localhost                 dbname:   database1                 user:     root                 password:              buv:                 driver:   pdo_mysql                 host:     localhost                 dbname:   database2                 user:     root                 password: 

i tried import schema following command:

$ php app/console doctrine:mapping:import --em=buv mybundle yml

[doctrine\dbal\schema\schemaexception] index '' not exist on table 'old_table'

but of tables in database2 have no pks! , full import dosn't work. want import 2 tables, tried:

$ php app/console doctrine:mapping:import --em=buv --filter="tablename" mybundle yml

but i'm getting same error, seems --filter isn't working.

the documentation in console command doctrine:mapping:import says put entity name in filter option. don't have entity yet.

if correctly, want import existing database?

what is:

php app/console doctrine:mapping:convert xml ./src/app/mybundle/resources/config/doctrine/metadata/orm --from-database --force 

then selective convert annotation:

php app/console doctrine:mapping:import appmybundle annotation --filter="users_table" 

if wanted yml, change annotation yml.

warning: when import annotation or yml, delete current entity file.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -