public static function create(array $options = array(), LoggerInterface $logger = null, EventManager $evm = null, ContainerInterface $container = null)
    {
        if (isset($options['entity_manager'])) {
            // Test the nature of the entity_manager parameter
            $em = self::getEntityManagerWithEntityManager($options['entity_manager']);
        } else {
            // Init ORM Configuration
            $config = self::getORMConfiguration($options, $logger, $container);

            if (isset($options['connection'])) {
                // An existing connection is provided
                $em = self::createEntityManagerWithConnection($options['connection'], $config, $evm);
            } else {
                $em = self::createEntityManagerWithParameters($options, $config, $evm);
            }
        }

        // Force a connection to the database
        $em->getConnection()->errorInfo();

        self::setConnectionCharset($em->getConnection(), $options);
        self::setConnectionCollation($em->getConnection(), $options);

        if ('sqlite' === $em->getConnection()->getDatabasePlatform()->getName()) {
            self::expandSqlite($em->getConnection());
        }

        return $em;
    }
public static function create(array $options = array(), LoggerInterface $logger = null, EventManager $evm = null, ContainerInterface $container = null)
    {
        if (isset($options['entity_manager'])) {
            // Test the nature of the entity_manager parameter
            $em = self::getEntityManagerWithEntityManager($options['entity_manager']);
        } else {
            // Init ORM Configuration
            $config = self::getORMConfiguration($options, $logger, $container);

            if (isset($options['connection'])) {
                // An existing connection is provided
                $em = self::createEntityManagerWithConnection($options['connection'], $config, $evm);
            } else {
                $em = self::createEntityManagerWithParameters($options, $config, $evm);
            }
        }

        // Force a connection to the database
        $em->getConnection()->errorInfo();

        self::setConnectionCharset($em->getConnection(), $options);
        self::setConnectionCollation($em->getConnection(), $options);

        if ('sqlite' === $em->getConnection()->getDatabasePlatform()->getName()) {
            self::expandSqlite($em->getConnection());
        }

        return $em;
    }
public static function create ( array $ options = array ( ) , LoggerInterface $ logger = null , EventManager $ evm = null , ContainerInterface $ container = null ) { if ( isset ( $ options [ 'entity_manager' ] ) ) { // Test the nature of the entity_manager parameter $ em = self :: getEntityManagerWithEntityManager ( $ options [ 'entity_manager' ] ) ; } else { // Init ORM Configuration $ config = self :: getORMConfiguration ( $ options , $ logger , $ container ) ; if ( isset ( $ options [ 'connection' ] ) ) { // An existing connection is provided $ em = self :: createEntityManagerWithConnection ( $ options [ 'connection' ] , $ config , $ evm ) ; } else { $ em = self :: createEntityManagerWithParameters ( $ options , $ config , $ evm ) ; } } // Force a connection to the database $ em -> getConnection ( ) -> errorInfo ( ) ; self :: setConnectionCharset ( $ em -> getConnection ( ) , $ options ) ; self :: setConnectionCollation ( $ em -> getConnection ( ) , $ options ) ; if ( 'sqlite' === $ em -> getConnection ( ) -> getDatabasePlatform ( ) -> getName ( ) ) { self :: expandSqlite ( $ em -> getConnection ( ) ) ; } return $ em ; }
Creates a new Doctrine entity manager.

@param  array           $options Options provided to get an entity manager, keys should be :
- entity_manager EntityManager Optional, an already defined EntityManager (simply returns it)
- connection     Connection    Optional, an already initialized database connection
- proxy_dir      string        The proxy directory
- proxy_ns       string        The namespace for Doctrine proxy
- charset        string        Optional, the charset to use
- collation      string        Optional, the collation to use
- ...            mixed         All the required parameter to open a new connection
@param  LoggerInterface $logger Optional logger
@param  EventManager    $evm    Optional event manager
@return EntityManager
@throws InvalidArgumentException Occurs if $entityManager can not be returned
Creates a new Doctrine entity manager .