public function getQbForFamiliesAndLabel(array $families, $term)
    {
        // Removing empty terms with wildcards on both sides
        if ('%%' === $term) {
            $term = '%';
        }

        // Specific optimisation for match-all queries
        if ('%' === $term) {
            return $this->repository->getQbForFamilies($families);
        }

        $eavQb = $this->repository->createEAVQueryBuilder();
        $orCondition = [];

        foreach ($families as $family) {
            $eavQbAttributes = $this->resolveEavQbAttributes($family, $eavQb);
            foreach ($eavQbAttributes as $eavQbAttribute) {
                $orCondition[] = $eavQbAttribute->like($term);
            }
        }

        return $eavQb->apply($eavQb->getOr($orCondition));
    }
public function getQbForFamiliesAndLabel(array $families, $term)
    {
        // Removing empty terms with wildcards on both sides
        if ('%%' === $term) {
            $term = '%';
        }

        // Specific optimisation for match-all queries
        if ('%' === $term) {
            return $this->repository->getQbForFamilies($families);
        }

        $eavQb = $this->repository->createEAVQueryBuilder();
        $orCondition = [];

        foreach ($families as $family) {
            $eavQbAttributes = $this->resolveEavQbAttributes($family, $eavQb);
            foreach ($eavQbAttributes as $eavQbAttribute) {
                $orCondition[] = $eavQbAttribute->like($term);
            }
        }

        return $eavQb->apply($eavQb->getOr($orCondition));
    }
public function getQbForFamiliesAndLabel ( array $ families , $ term ) { // Removing empty terms with wildcards on both sides if ( '%%' === $ term ) { $ term = '%' ; } // Specific optimisation for match-all queries if ( '%' === $ term ) { return $ this -> repository -> getQbForFamilies ( $ families ) ; } $ eavQb = $ this -> repository -> createEAVQueryBuilder ( ) ; $ orCondition = [ ] ; foreach ( $ families as $ family ) { $ eavQbAttributes = $ this -> resolveEavQbAttributes ( $ family , $ eavQb ) ; foreach ( $ eavQbAttributes as $ eavQbAttribute ) { $ orCondition [ ] = $ eavQbAttribute -> like ( $ term ) ; } } return $ eavQb -> apply ( $ eavQb -> getOr ( $ orCondition ) ) ; }
This method was moved from the DataRepository because it depends on the FamilyRegistry to resolve sub families

@param FamilyInterface[] $families
@param string            $term

@throws \Sidus\EAVModelBundle\Exception\MissingFamilyException
@throws \LogicException
@throws \UnexpectedValueException

@return QueryBuilder
This method was moved from the DataRepository because it depends on the FamilyRegistry to resolve sub families