protected function getEntityManager($name, $shardId = null)
    {
        $manager = $this->getDoctrine()->getManager($name);

        if ($shardId) {
            if (! $manager->getConnection() instanceof PoolingShardConnection) {
                throw new LogicException(sprintf("Connection of EntityManager '%s' must implement shards configuration.", $name));
            }

            $manager->getConnection()->connect($shardId);
        }

        return $manager;
    }
protected function getEntityManager($name, $shardId = null)
    {
        $manager = $this->getDoctrine()->getManager($name);

        if ($shardId) {
            if (! $manager->getConnection() instanceof PoolingShardConnection) {
                throw new LogicException(sprintf("Connection of EntityManager '%s' must implement shards configuration.", $name));
            }

            $manager->getConnection()->connect($shardId);
        }

        return $manager;
    }
protected function getEntityManager ( $ name , $ shardId = null ) { $ manager = $ this -> getDoctrine ( ) -> getManager ( $ name ) ; if ( $ shardId ) { if ( ! $ manager -> getConnection ( ) instanceof PoolingShardConnection ) { throw new LogicException ( sprintf ( "Connection of EntityManager '%s' must implement shards configuration." , $ name ) ) ; } $ manager -> getConnection ( ) -> connect ( $ shardId ) ; } return $ manager ; }
Get a doctrine entity manager by symfony name.

@param string   $name
@param int|null $shardId

@return EntityManager
Get a doctrine entity manager by symfony name .