質問

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 ?

役に立ちましたか?

解決

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top