dominikzogg/doctrine-orm-manager-registry-provider

Doctrine ORM Manager Registry Provider

1.3.5 2014-02-01 11:01 UTC

README

Deprecated

Please use saxulum/saxulum-doctrine-orm-manager-registry-provider in version >= 2.0

{
    "require": {
        "saxulum/saxulum-doctrine-orm-manager-registry-provider": "~2.0"
    }
}

Build Status Total Downloads Latest Stable Version

Features

Requirements

  • PHP 5.3+
  • Doctrine ~2.3

Currently requires both dbs and orm.ems services in order to work. These can be provided by a Doctrine Service Provider like the Silex or Cilex and the Doctrine ORM Serice Provider like the dflydev-doctrine-orm-service-provider service providers. If you can or want to fake it, go for it. :)

Installation

Through Composer as dominikzogg/doctrine-orm-manager-registry-provider.

use Dominikzogg\Silex\Provider\DoctrineOrmManagerRegistryProvider;

$app->register(new DoctrineOrmManagerRegistryProvider());

Form Entity Type

If you like to have Entity Type Support within Symfony Form Component, install the Doctrine Bridge and register the form provider first.

"symfony/doctrine-bridge": "~2.2",
"symfony/form": "~2.2"
use Dominikzogg\Silex\Provider\DoctrineOrmManagerRegistryProvider;
use Silex\Provider\FormServiceProvider;

$app->register(new FormServiceProvider());
$app->register(new DoctrineOrmManagerRegistryProvider());

Doctrine ORM Console

If you like to use Doctrine ORM Console commands, install Doctrine ORM Console and the Saxulum Console Provider and register the console provider.

"saxulum-doctrine-orm-commands": "~1.0.0",
"saxulum/saxulum-console": "~1.1.1",
use Dominikzogg\Silex\Provider\DoctrineOrmManagerRegistryProvider;
use Saxulum\Console\Silex\Provider\ConsoleProvider;

$app->register(new ConsoleProvider());
$app->register(new DoctrineOrmManagerRegistryProvider());

Usage

<?php

// get the default connection name
$app['doctrine']->getDefaultConnectionName();

// get the default connection 
$app['doctrine']->getConnection();

// get a connection by name
$app['doctrine']->getConnection('name');

// all connections as array access (pimple)
$app['doctrine']->getConnections();

// all connection names as array
$app['doctrine']->getConnectionNames();

// get the default manager name
$app['doctrine']->getDefaultManagerName();

// get the default manager
$app['doctrine']->getManager();

// get a manager by name
$app['doctrine']->getManager('name');

// all manager as array access (pimple)
$app['doctrine']->getManagers();

// all manager names as array
$app['doctrine']->getManagerNames();
...