A wrapper for setting up the Doctrine EntityManager to use it in all modules of EasyBib. It assumes you're using a ZF MVC application with modules placed inside an "app" folder.
- Use composer to add EasyBib_DoctrineResource as dependency
- Drop in a doctrine.ini into your config folder - see docs folder for an example
- Use it!
-
Load your doctrine.ini with Zend_Config_Ini or ez_Core_LoadConfig (Zend_Config_Ini object is needed!)
-
Set the options of Resource:
- timestampble: enables Gedmo Timestampable support for Doctrine entities see https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/timestampable.md
- sluggable: enables Gedmo Sluggable support for Doctrine entities see https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/sluggable.md
- tree: enables Gedmo Tree nested behavior for Doctrine entities see: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/tree.md
- profile: enables debugging of all Doctrine SQL queries (they get echoed)
-
Initialize DoctrineResource by:
$doctrineResource = new \EasyBib\Doctrine\DoctrineResource( $doctrineIniConfig, // your doctrine.ini settings $root, // path to your app root folder 'default', // zf mvc module name you want to use the DoctrineResource from $options // the options array for loading needed PlugIns, can be an empty array() );
-
Use the Doctrine EntityManager:
$em = $doctrineResource->getEntityManager();
-
Have fun with Doctrine!