private static function createEntityManagerWithConnection($connection, Configuration $config, EventManager $evm = null)
    {
        if ($connection instanceof Connection) {
            try {
                return EntityManager::create($connection, $config, $evm);
            } catch (\Exception $e) {
                throw new InvalidArgumentException(
                    'Enable to create new EntityManager with provided Connection',
                    InvalidArgumentException::INVALID_ARGUMENT,
                    $e
                );
            }
        }

        throw new InvalidArgumentException('Invalid Connection provided', InvalidArgumentException::INVALID_ARGUMENT);
    }
private static function createEntityManagerWithConnection($connection, Configuration $config, EventManager $evm = null)
    {
        if ($connection instanceof Connection) {
            try {
                return EntityManager::create($connection, $config, $evm);
            } catch (\Exception $e) {
                throw new InvalidArgumentException(
                    'Enable to create new EntityManager with provided Connection',
                    InvalidArgumentException::INVALID_ARGUMENT,
                    $e
                );
            }
        }

        throw new InvalidArgumentException('Invalid Connection provided', InvalidArgumentException::INVALID_ARGUMENT);
    }
private static function createEntityManagerWithConnection ( $ connection , Configuration $ config , EventManager $ evm = null ) { if ( $ connection instanceof Connection ) { try { return EntityManager :: create ( $ connection , $ config , $ evm ) ; } catch ( \ Exception $ e ) { throw new InvalidArgumentException ( 'Enable to create new EntityManager with provided Connection' , InvalidArgumentException :: INVALID_ARGUMENT , $ e ) ; } } throw new InvalidArgumentException ( 'Invalid Connection provided' , InvalidArgumentException :: INVALID_ARGUMENT ) ; }
Returns a new EntityManager with the provided connection.

@param  Connection    $connection
@param  Configuration $config
@param  EventManager  $evm        Optional event manager
@return EntityManager
@throws InvalidArgumentException Occurs if $entityManager can not be created
Returns a new EntityManager with the provided connection .