-
-
Save nachopants/d44fce5052dde57bd745 to your computer and use it in GitHub Desktop.
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
Array | |
( | |
[0] => Doctrine\ORM\Query\Expr\Comparison Object | |
( | |
[leftExpr:protected] => f.fundId | |
[operator:protected] => = | |
[rightExpr:protected] => :fundId | |
) | |
[1] => Doctrine\ORM\Query\Expr\Comparison Object | |
( | |
[leftExpr:protected] => f.fundName | |
[operator:protected] => LIKE | |
[rightExpr:protected] => :fundName | |
) | |
) | |
Doctrine\Common\Collections\ArrayCollection Object | |
( | |
[_elements:Doctrine\Common\Collections\ArrayCollection:private] => Array | |
( | |
[0] => Doctrine\ORM\Query\Parameter Object | |
( | |
[name:Doctrine\ORM\Query\Parameter:private] => fundId | |
[value:Doctrine\ORM\Query\Parameter:private] => 9697 | |
[type:Doctrine\ORM\Query\Parameter:private] => 2 | |
) | |
[1] => Doctrine\ORM\Query\Parameter Object | |
( | |
[name:Doctrine\ORM\Query\Parameter:private] => fundName | |
[value:Doctrine\ORM\Query\Parameter:private] => Rosemary | |
[type:Doctrine\ORM\Query\Parameter:private] => 2 | |
) | |
) | |
) | |
SELECT f0_.id AS id_0, f0_.fundId AS fundId_1, f0_.fundName AS fundName_2, f0_.brandCode AS brandCode_3, f0_.abn AS abn_4, f0_.tfn AS tfn_5, f0_.dataSource AS dataSource_6, f0_.createdDate AS createdDate_7 FROM Fund f0_ |
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 | |
$qb = $repo->createQueryBuilder('f'); | |
$conditions = array(); | |
$e = $qb->expr(); | |
foreach ($params AS $key => $param) | |
{ | |
if ($param === null) continue; | |
if ($key === 'fundName') | |
{ | |
$conditions[] = $e->like('f.fundName', ':fundName'); | |
$qb->setParameter('fundName', $param); | |
continue; | |
} | |
$conditions[] = $e->eq('f.' . $key, ':' . $key); | |
$qb->setParameter($key, $param); | |
} | |
$qb->where($qb->expr()->andX($conditions)); | |
merk
commented
Jul 29, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment