문제

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