2017 © Pedro Peláez
 

library saxulum-doctrine-mongodb-odm-manager-registry-provider

Doctrine MongoDB ODM Manager Registry Provider

image

saxulum/saxulum-doctrine-mongodb-odm-manager-registry-provider

Doctrine MongoDB ODM Manager Registry Provider

  • Thursday, October 26, 2017
  • by dominikzogg
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,344 Installations
  • PHP
  • 2 Dependents
  • 2 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 17 % Grown

The README.md

saxulum-doctrine-mongodb-odm-manager-registry-provider

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality, (*1)

Features

Requirements

  • PHP 5.5+
  • Doctrine MongoDB ODM ~1.0

Currently requires both mongodbs and mongodbodm.dms services in order to work. These can be provided by a Doctrine MongoDB Service Provider and the Doctrine MongoDB ODM Service Provider service providers. If you can or want to fake it, go for it. :), (*2)

Installation

Through Composer as saxulum/saxulum-doctrine-mongodb-odm-manager-registry-provider., (*3)

```{.sh} composer require "saxulum/saxulum-doctrine-mongodb-odm-manager-registry-provider": "dev-master@dev", (*4)


```{.php} <?php use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider; $app->register(new DoctrineMongodbOdmManagerRegistryProvider());

Form Document Type

If you like to have Document Type Support within Symfony Form Component, install the Doctrine Bridge and register the form provider first., (*5)

```{.json} { "require": { "symfony/doctrine-bridge": "~2.3|~3.0", "symfony/form": "~2.3|~3.0" } }, (*6)


```{.php} <?php use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider; use Silex\Provider\FormServiceProvider; $app->register(new FormServiceProvider()); $app->register(new DoctrineMongodbOdmManagerRegistryProvider());

Validator

If you like to have Unique Constraint Support within [Symfony Validator Component][9], install the Doctrine Bridge and register the validator provider first., (*7)

```{.json} { "require": { "symfony/doctrine-bridge": "~2.3|~3.0", "symfony/validator": "~2.3|~3.0" } }, (*8)


```{.php} <?php use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider; use Silex\Provider\ValidatorServiceProvider; $app->register(new ValidatorServiceProvider()); $app->register(new DoctrineMongodbOdmManagerRegistryProvider());

```{.php} <?php, (*9)

use Doctrine\ORM\Mapping as ORM; use Saxulum\DoctrineMongodbOdmManagerRegistry\Validator\Constraints\Unique; use Symfony\Component\Validator\Mapping\ClassMetadata;, (*10)

/** * @ORM\Document() * @ORM\Table(name="sample") */ class Sample { /** * @var string * @ORM\Column(name="name", type="string") */ protected $name;, (*11)

/**
 * @param ClassMetadata $metadata
 */
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
    $metadata->addConstraint(new Unique(array(
        'fields'  => 'name',
        'message' => 'This name already exists.',
    )));
}

}, (*12)


### Symfony Console If you like to use [Doctrine MongoDB ODM Commands][7], install [Doctrine MongoDB ODM Commands][7] and the [Saxulum Console Provider][8] and register the console provider. ```{.json} { "require": { "saxulum/saxulum-doctrine-mongodb-odm-commands": "dev-master@dev", "saxulum/saxulum-console": "~2.3|~3.0", } }

```{.php} <?php, (*13)

use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider; use Saxulum\Console\Provider\ConsoleProvider;, (*14)

$app->register(new ConsoleProvider()); $app->register(new DoctrineMongodbOdmManagerRegistryProvider());, (*15)


Usage ----- ```{.php} <?php // get the default connection name $app['doctrine_mongodb']->getDefaultConnectionName(); // get the default connection $app['doctrine_mongodb']->getConnection(); // get a connection by name $app['doctrine_mongodb']->getConnection('name'); // all connections as array access (pimple) $app['doctrine_mongodb']->getConnections(); // all connection names as array $app['doctrine_mongodb']->getConnectionNames(); // get the default manager name $app['doctrine_mongodb']->getDefaultManagerName(); // get the default manager $app['doctrine_mongodb']->getManager(); // get a manager by name $app['doctrine_mongodb']->getManager('name'); // all manager as array access (pimple) $app['doctrine_mongodb']->getManagers(); // all manager names as array $app['doctrine_mongodb']->getManagerNames(); ...

The Versions

20/09 2015

v1.x-dev

1.9999999.9999999.9999999-dev

Doctrine MongoDB ODM Manager Registry Provider

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

mongodb silex doctrine odm pimple cilex registrymanager

20/09 2015