<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
saxulum / saxulum-doctrine-mongodb-odm-manager-registry-provider example snippets
{.php}
use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider;
$app->register(new DoctrineMongodbOdmManagerRegistryProvider());
{.php}
use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider;
use Silex\Provider\FormServiceProvider;
$app->register(new FormServiceProvider());
$app->register(new DoctrineMongodbOdmManagerRegistryProvider());
{.php}
use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider;
use Silex\Provider\ValidatorServiceProvider;
$app->register(new ValidatorServiceProvider());
$app->register(new DoctrineMongodbOdmManagerRegistryProvider());
{.php}
use Doctrine\ORM\Mapping as ORM;
use Saxulum\DoctrineMongodbOdmManagerRegistry\Validator\Constraints\Unique;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* @ORM\Document()
* @ORM\Table(name="sample")
*/
class Sample
{
/**
* @var string
* @ORM\Column(name="name", type="string")
*/
protected $name;
/**
* @param ClassMetadata $metadata
*/
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addConstraint(new Unique(array(
'fields' => 'name',
'message' => 'This name already exists.',
)));
}
}
{.php}
use Saxulum\DoctrineMongodbOdmManagerRegistry\Provider\DoctrineMongodbOdmManagerRegistryProvider;
use Saxulum\Console\Provider\ConsoleProvider;
$app->register(new ConsoleProvider());
$app->register(new DoctrineMongodbOdmManagerRegistryProvider());
{.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();
...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.