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;
    }