src/Repository/IconRepository.php
public function findDataByHashes(array $hashes, array $modCombinationIds = []): array
    {
        $result = [];
        if (count($hashes) > 0) {
            $columns = [
                'i.id AS id',
                'IDENTITY(i.file) AS hash',
                'i.type AS type',
                'i.name AS name',
                'mc.order AS order'
            ];

            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select($columns)
                         ->from(Icon::class, 'i')
                         ->innerJoin('i.modCombination', 'mc')
                         ->andWhere('i.file IN (:hashes)')
                         ->setParameter('hashes', array_map('hex2bin', array_values($hashes)));

            if (count($modCombinationIds) > 0) {
                $queryBuilder->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }

            $result = $this->mapIconDataResult($queryBuilder->getQuery()->getResult());
        }
        return $result;
    }
public function findDataByHashes(array $hashes, array $modCombinationIds = []): array
    {
        $result = [];
        if (count($hashes) > 0) {
            $columns = [
                'i.id AS id',
                'IDENTITY(i.file) AS hash',
                'i.type AS type',
                'i.name AS name',
                'mc.order AS order'
            ];

            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select($columns)
                         ->from(Icon::class, 'i')
                         ->innerJoin('i.modCombination', 'mc')
                         ->andWhere('i.file IN (:hashes)')
                         ->setParameter('hashes', array_map('hex2bin', array_values($hashes)));

            if (count($modCombinationIds) > 0) {
                $queryBuilder->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }

            $result = $this->mapIconDataResult($queryBuilder->getQuery()->getResult());
        }
        return $result;
    }
public function findDataByHashes ( array $ hashes , array $ modCombinationIds = [ ] ) : array { $ result = [ ] ; if ( count ( $ hashes ) > 0 ) { $ columns = [ 'i.id AS id' , 'IDENTITY(i.file) AS hash' , 'i.type AS type' , 'i.name AS name' , 'mc.order AS order' ] ; $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( $ columns ) -> from ( Icon :: class , 'i' ) -> innerJoin ( 'i.modCombination' , 'mc' ) -> andWhere ( 'i.file IN (:hashes)' ) -> setParameter ( 'hashes' , array_map ( 'hex2bin' , array_values ( $ hashes ) ) ) ; if ( count ( $ modCombinationIds ) > 0 ) { $ queryBuilder -> andWhere ( 'mc.id IN (:modCombinationIds)' ) -> setParameter ( 'modCombinationIds' , array_values ( $ modCombinationIds ) ) ; } $ result = $ this -> mapIconDataResult ( $ queryBuilder -> getQuery ( ) -> getResult ( ) ) ; } return $ result ; }
Finds the data of the icons with the specified hashes.
@param array|string[] $hashes
@param array|int[] $modCombinationIds
@return array|IconData[]
Finds the data of the icons with the specified hashes .