Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate YAML schema or models for Doctrine from MySQL database

Is it somehow possible to automatically generate a YAML schema file or models from an existing MySQL database?

I need to create models for Doctrine but writing the model classes manually seems extremely boring to me. I already have MySQL database with tables and all relations so it would help me if there is some way to generate Doctrine models from it.

like image 864
Richard Knop Avatar asked Feb 26 '11 15:02

Richard Knop


2 Answers

If you are using doctrine 2:

http://www.doctrine-project.org/docs/orm/2.0/en/reference/tools.html#reverse-engineering

like image 116
rojoca Avatar answered Nov 20 '22 01:11

rojoca


Yes, it is possible ;-)


For Doctrine 1.2, take a look at the Command Line Interface : amongst other utilities, you have the possibity to generate the YAML files from an existing database.

And, for Doctrine 2.0, you'll want to take a look at Reverse Engineering

like image 23
Pascal MARTIN Avatar answered Nov 19 '22 23:11

Pascal MARTIN