Category Archives: Doctrine

Doctrine 2 ORM – Understanding of relationship/references between entities

Understanding of Reference and specially which site is owning and which is inverse in entities, could be tricky to understand for some people. Doctrine ORM provide easy way without having too much knowledge of database relationships.

References between objects are foreign keys in the database. You never have to work with the foreign keys directly, only with objects that represent the foreign key through their own identity.

For every foreign key you either have a Doctrine ManyToOne or OneToOne association. On the inverse sides of these foreign keys you can have OneToMany associations. Obviously you can have ManyToMany associations that connect two tables with each other through a join table with two foreign keys.

Continue reading

How to install Zend Framework 2 with Doctrine?

Composer makes ZF2 and Doctrine installation easy.

git clone git://github.com/zendframework/ZendSkeletonApplication.git
php composer.phar self-update
php composer.phar require doctrine/doctrine-orm-module:0.7.*
php composer.phar require zendframework/zend-developer-tools:dev-master
cp vendor/zendframework/zend-developer-tools/config/zenddevelopertools.local.php.dist config/autoload/zdt.local.php

chmod 777 data/cache/
./vendor/bin/doctrine-module orm:validate-schema
./vendor/bin/doctrine-module orm:schema-tool:create