cranberyxl/doctrine-manager-registry-silex-provider

dev-master 2013-02-11 18:08 UTC

This package is not auto-updated.

Last update: 2024-05-19 01:49:20 UTC


README

Provides the ability to build 1 or more Doctrine ManafgerRegistries for use in your Silex project.

Composer

{
    "require": {
        "cranberyxl/doctrine-manager-registry-provider": "*"
    }
}

Register

<?php

use Silex\Provider\DoctrineManagerRegistryServiceProvider;

$app = new Silex\Application();

$app->register(new DoctrineManagerRegistryServiceProvider(), array(
    'doctrine.common.manager_registry.definitions' => array(
        'mongodb' => array(
            'connections' => array('default' => 'doctrine.mongodb.connection'),
            'managers' => array('default' => 'doctrine.mongodb.dm'),
            'default_connection' => 'default',
            'default_manager' => 'default',
            'proxy_interface_name' => 'Doctrine\ODM\MongoDB\Proxy\Proxy' // Defaults to Doctrine\Common\Proxy
        )
    ),
));

Use

$app['form.document_type'] = $app->share(function(Application $app) {
    return new DocumentType($app['doctrine.common.manager_registry.map']['mongodb']);
});