private function addStockPropertiesToQueryBuilder(
        QueryBuilder $queryBuilder,
        $useStock
    ) {
        if ($useStock) {
            $queryBuilder
                ->andWhere($queryBuilder->expr()->orX(
                    $queryBuilder->expr()->gt('p.stock', ':stockZero'),
                    $queryBuilder->expr()->eq('p.stock', ':infiniteStock')
                ))
                ->setParameter(
                    'stockZero',
                    0
                )
                ->setParameter(
                    'infiniteStock',
                    ElcodiProductStock::INFINITE_STOCK
                );
        }
    }
private function addStockPropertiesToQueryBuilder(
        QueryBuilder $queryBuilder,
        $useStock
    ) {
        if ($useStock) {
            $queryBuilder
                ->andWhere($queryBuilder->expr()->orX(
                    $queryBuilder->expr()->gt('p.stock', ':stockZero'),
                    $queryBuilder->expr()->eq('p.stock', ':infiniteStock')
                ))
                ->setParameter(
                    'stockZero',
                    0
                )
                ->setParameter(
                    'infiniteStock',
                    ElcodiProductStock::INFINITE_STOCK
                );
        }
    }
private function addStockPropertiesToQueryBuilder ( QueryBuilder $ queryBuilder , $ useStock ) { if ( $ useStock ) { $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> orX ( $ queryBuilder -> expr ( ) -> gt ( 'p.stock' , ':stockZero' ) , $ queryBuilder -> expr ( ) -> eq ( 'p.stock' , ':infiniteStock' ) ) ) -> setParameter ( 'stockZero' , 0 ) -> setParameter ( 'infiniteStock' , ElcodiProductStock :: INFINITE_STOCK ) ; } }
Add stock properties to query builder.

@param QueryBuilder $queryBuilder QueryBuilder
@param bool         $useStock     Use stock
Add stock properties to query builder .