src/Repository/ModRepository.php
public function findByNamesWithDependencies(array $modNames): array
    {
        $result = [];
        if (count($modNames) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select(['m', 'd', 'dm'])
                         ->from(Mod::class, 'm')
                         ->leftJoin('m.dependencies', 'd')
                         ->leftJoin('d.requiredMod', 'dm')
                         ->andWhere('m.name IN (:modNames)')
                         ->setParameter('modNames', array_values($modNames));

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
public function findByNamesWithDependencies(array $modNames): array
    {
        $result = [];
        if (count($modNames) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select(['m', 'd', 'dm'])
                         ->from(Mod::class, 'm')
                         ->leftJoin('m.dependencies', 'd')
                         ->leftJoin('d.requiredMod', 'dm')
                         ->andWhere('m.name IN (:modNames)')
                         ->setParameter('modNames', array_values($modNames));

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
public function findByNamesWithDependencies ( array $ modNames ) : array { $ result = [ ] ; if ( count ( $ modNames ) > 0 ) { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( [ 'm' , 'd' , 'dm' ] ) -> from ( Mod :: class , 'm' ) -> leftJoin ( 'm.dependencies' , 'd' ) -> leftJoin ( 'd.requiredMod' , 'dm' ) -> andWhere ( 'm.name IN (:modNames)' ) -> setParameter ( 'modNames' , array_values ( $ modNames ) ) ; $ result = $ queryBuilder -> getQuery ( ) -> getResult ( ) ; } return $ result ; }
Finds all mods with the specified names, fetching their dependencies as well.
@param array|string[] $modNames
@return array|Mod[]
Finds all mods with the specified names fetching their dependencies as well .