lib/Doctrine/ORM/Tools/Console/Command/MappingDescribeCommand.php
private function getClassMetadata($entityName, EntityManagerInterface $entityManager)
    {
        try {
            return $entityManager->getClassMetadata($entityName);
        } catch (MappingException $e) {
        }

        $matches = array_filter(
            $this->getMappedEntities($entityManager),
            static function ($mappedEntity) use ($entityName) {
                return preg_match('{' . preg_quote($entityName) . '}', $mappedEntity);
            }
        );

        if (! $matches) {
            throw new InvalidArgumentException(sprintf(
                'Could not find any mapped Entity classes matching "%s"',
                $entityName
            ));
        }

        if (count($matches) > 1) {
            throw new InvalidArgumentException(sprintf(
                'Entity name "%s" is ambiguous, possible matches: "%s"',
                $entityName,
                implode(', ', $matches)
            ));
        }

        return $entityManager->getClassMetadata(current($matches));
    }
private function getClassMetadata($entityName, EntityManagerInterface $entityManager)
    {
        try {
            return $entityManager->getClassMetadata($entityName);
        } catch (MappingException $e) {
        }

        $matches = array_filter(
            $this->getMappedEntities($entityManager),
            static function ($mappedEntity) use ($entityName) {
                return preg_match('{' . preg_quote($entityName) . '}', $mappedEntity);
            }
        );

        if (! $matches) {
            throw new InvalidArgumentException(sprintf(
                'Could not find any mapped Entity classes matching "%s"',
                $entityName
            ));
        }

        if (count($matches) > 1) {
            throw new InvalidArgumentException(sprintf(
                'Entity name "%s" is ambiguous, possible matches: "%s"',
                $entityName,
                implode(', ', $matches)
            ));
        }

        return $entityManager->getClassMetadata(current($matches));
    }
private function getClassMetadata ( $ entityName , EntityManagerInterface $ entityManager ) { try { return $ entityManager -> getClassMetadata ( $ entityName ) ; } catch ( MappingException $ e ) { } $ matches = array_filter ( $ this -> getMappedEntities ( $ entityManager ) , static function ( $ mappedEntity ) use ( $ entityName ) { return preg_match ( '{' . preg_quote ( $ entityName ) . '}' , $ mappedEntity ) ; } ) ; if ( ! $ matches ) { throw new InvalidArgumentException ( sprintf ( 'Could not find any mapped Entity classes matching "%s"' , $ entityName ) ) ; } if ( count ( $ matches ) > 1 ) { throw new InvalidArgumentException ( sprintf ( 'Entity name "%s" is ambiguous, possible matches: "%s"' , $ entityName , implode ( ', ' , $ matches ) ) ) ; } return $ entityManager -> getClassMetadata ( current ( $ matches ) ) ; }
Return the class metadata for the given entity
name

@param string $entityName Full or partial entity name

@return ClassMetadata
Return the class metadata for the given entity name