src/Bridge/Doctrine/Orm/Util/EagerLoadingTrait.php
private function hasFetchEagerAssociation(EntityManager $em, ClassMetadataInfo $classMetadata, array &$checked = []): bool
    {
        $checked[] = $classMetadata->name;

        foreach ($classMetadata->getAssociationMappings() as $mapping) {
            if (ClassMetadataInfo::FETCH_EAGER === $mapping['fetch']) {
                return true;
            }

            $related = $em->getClassMetadata($mapping['targetEntity']);

            if (\in_array($related->name, $checked, true)) {
                continue;
            }

            if (true === $this->hasFetchEagerAssociation($em, $related, $checked)) {
                return true;
            }
        }

        return false;
    }
private function hasFetchEagerAssociation(EntityManager $em, ClassMetadataInfo $classMetadata, array &$checked = []): bool
    {
        $checked[] = $classMetadata->name;

        foreach ($classMetadata->getAssociationMappings() as $mapping) {
            if (ClassMetadataInfo::FETCH_EAGER === $mapping['fetch']) {
                return true;
            }

            $related = $em->getClassMetadata($mapping['targetEntity']);

            if (\in_array($related->name, $checked, true)) {
                continue;
            }

            if (true === $this->hasFetchEagerAssociation($em, $related, $checked)) {
                return true;
            }
        }

        return false;
    }
private function hasFetchEagerAssociation ( EntityManager $ em , ClassMetadataInfo $ classMetadata , array & $ checked = [ ] ) : bool { $ checked [ ] = $ classMetadata -> name ; foreach ( $ classMetadata -> getAssociationMappings ( ) as $ mapping ) { if ( ClassMetadataInfo :: FETCH_EAGER === $ mapping [ 'fetch' ] ) { return true ; } $ related = $ em -> getClassMetadata ( $ mapping [ 'targetEntity' ] ) ; if ( \ in_array ( $ related -> name , $ checked , true ) ) { continue ; } if ( true === $ this -> hasFetchEagerAssociation ( $ em , $ related , $ checked ) ) { return true ; } } return false ; }
Checks if the class has an associationMapping with FETCH=EAGER.

@param array $checked array cache of tested metadata classes
Checks if the class has an associationMapping with FETCH = EAGER .