Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert database tables to doctrine entities

I am using doctrine and codeigniter and I have an existing db.this tool supposedly enables generating models from a database.

I try :

php doctrine.php orm:convert-mapping --from-database

But I get a Runtime exception (NOt enough arguments)

any ideas?

like image 271
Borut Flis Avatar asked Dec 11 '22 18:12

Borut Flis


2 Answers

Try like this,

For the XML output

php doctrine orm:convert-mapping --from-database --namespace='Entities\' xml mapping/xml

For the YAML output

php doctrine orm:convert-mapping --from-database --namespace='Entities\' yml mapping/yml

After that you should create entities like this,

php doctrine orm:generate-entities

Help,

php doctrine orm:generate-entities --help

For the more information, docs

like image 123
Adem Öztaş Avatar answered Feb 09 '23 07:02

Adem Öztaş


You missed some arguments like project full path

php doctrine orm:convert-mapping --namespace='Entities\' --force --from-database  annotation your/project/full/path
like image 31
Farid Movsumov Avatar answered Feb 09 '23 06:02

Farid Movsumov