public static function getManager(ManagerRegistry $or, $class)
    {
        $manager = $or->getManagerForClass($class);

        if (null === $manager) {
            foreach ($or->getManagers() as $objectManager) {
                if ($objectManager->getMetadataFactory()->hasMetadataFor($class)
                        && self::isValidManager($objectManager, $class)) {
                    $manager = $objectManager;

                    break;
                }
            }
        }

        return $manager;
    }
public static function getManager(ManagerRegistry $or, $class)
    {
        $manager = $or->getManagerForClass($class);

        if (null === $manager) {
            foreach ($or->getManagers() as $objectManager) {
                if ($objectManager->getMetadataFactory()->hasMetadataFor($class)
                        && self::isValidManager($objectManager, $class)) {
                    $manager = $objectManager;

                    break;
                }
            }
        }

        return $manager;
    }
public static function getManager ( ManagerRegistry $ or , $ class ) { $ manager = $ or -> getManagerForClass ( $ class ) ; if ( null === $ manager ) { foreach ( $ or -> getManagers ( ) as $ objectManager ) { if ( $ objectManager -> getMetadataFactory ( ) -> hasMetadataFor ( $ class ) && self :: isValidManager ( $ objectManager , $ class ) ) { $ manager = $ objectManager ; break ; } } } return $ manager ; }
Get the doctrine object manager of the class.

@param ManagerRegistry $or    The doctrine registry
@param string          $class The class name or doctrine shortcut class name

@return null|ObjectManager
Get the doctrine object manager of the class .