Created
April 21, 2018 10:35
-
-
Save evgeniy1204/f9030e20971d498b20c82e1001ab866f to your computer and use it in GitHub Desktop.
rp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Search products with options | |
* | |
* @param array $options | |
* | |
* @return array | |
*/ | |
public function searchProducts(array $options = []) | |
{ | |
$qb = $this->createQueryBuilder('s') | |
->select('s'); | |
$qb->leftJoin('ProductBundle:ProductVariation', 'productVariation', 'WITH', 'productVariation.product = s.id'); | |
$qb->andWhere('productVariation.isAvailable = 1') | |
->andWhere('productVariation.amount > 0'); | |
$qb->setMaxResults(10); | |
dump($qb->getQuery()); | |
dump($qb->getQuery()->getResult()); | |
die; | |
return $qb->getQuery()->getResult(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment