0

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 ?

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

Not sure what's going on with that dev documentation - but it looks like ZF1 code?
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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.