src/ResetableEntityManager.php
public static function create($conn, Configuration $config, EventManager $eventManager = null)
    {
        try{
            return self::getEntityManager()->create($conn, $config, $eventManager);
        } catch(ORMException $e) {
            if (!self::getEntityManager()->isOpen()) {
                self::resetEntityManager();
            }
            throw $e;
        }
    }
public static function create($conn, Configuration $config, EventManager $eventManager = null)
    {
        try{
            return self::getEntityManager()->create($conn, $config, $eventManager);
        } catch(ORMException $e) {
            if (!self::getEntityManager()->isOpen()) {
                self::resetEntityManager();
            }
            throw $e;
        }
    }
Factory method to create EntityManager instances.

@param mixed         $conn         An array with the connection parameters or an existing Connection instance.
@param Configuration $config       The Configuration instance to use.
@param EventManager  $eventManager The EventManager instance to use.

@return EntityManager The created EntityManager.

@throws \InvalidArgumentException
@throws ORMException