Skip to content

angun33/nutwerk-orm-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Doctrine ORM Service Provider for Silex
=======================================
This extension sets up Doctrine ORM for Silex by reusing the database connection established with the DBAL extension.


Installation
------------

cd /path/to/silex_project/vendor
git clone [email protected]:mjakubowski/nutwerk-orm-extension.git

Download Doctrine ORM package to /path/to/silex_project/vendor/doctrine2-orm

Edit your index.php:

$app['autoloader']->registerNamespace('Nutwerk', __DIR__.'/vendor/nutwerk-orm-extension/lib');
$app->register(new Nutwerk\Provider\DoctrineORMServiceProvider(), array(
    'db.orm.class_path'            => __DIR__.'/vendor/doctrine2-orm/lib',
    'db.orm.proxies_dir'           => __DIR__.'/var/cache/doctrine/Proxy',
    'db.orm.proxies_namespace'     => 'DoctrineProxy',
    'db.orm.auto_generate_proxies' => true,
    'db.orm.entities'              => array(array(
        'type'      => 'annotation', 
        'path'      => __DIR__.'/app', 
        'namespace' => 'Entity',
    )),
));


By default this setup assumes you put your entities beneath app/Entity/*

The EntityManager will be available by $app['db.orm.em']

By default the ArrayCache is used for doctrine caching. This may only be useful in development,
so if you want to use another cache you can set it by adding the correspondig config key:

'db.orm.cache' => new Doctrine\Common\Cache\ApcCache(),

About

Doctrine ORM Extension for Silex

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published