I was wondering if Zend has any way to automatically construct a database from model declarations. I could not find any documentation on the matter. I'm talking now from the point of view of someone who has experience in Python, where both Django ORM and SQLAlchemy provide a way to automatically create all database tables by some simple introspection of the models. Is something like this available for Zend or do I have to manually create my database ?
Asked
Active
Viewed 144 times
1 Answers
1
You could install the Doctrine2 module for ZF2: https://github.com/doctrine/DoctrineModule
You'll be forced to write entities in the Doctrine way, though. Once you created your entities you'll then have to use a console command to generate the SQL and inject the tables like so:
orm:schema-tool:create
Whenever you change something in your entities you then have to run:
orm:schema-tool:update

demonkoryu
- 1,247
- 10
- 27

cptnk
- 2,430
- 18
- 29
-
Not sure what's going on with that dev documentation - but it looks like ZF1 code? – Aydin Hassan Sep 12 '13 at 10:17
-
Now that you mention it it does look a bit off. But this has namespaces in it. Was it possible just like that in zf1? I tought you had to use workarounds to get that behavior? – cptnk Sep 12 '13 at 10:49