Created
March 28, 2011 15:15
-
-
Save janmarek/890638 to your computer and use it in GitHub Desktop.
This file contains 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 | |
class OfferFinder extends Blabla | |
{ | |
public function whereTags(array $tags) | |
{ | |
if (count($tags) === 0) { | |
return; | |
} | |
$ids = array_map(function ($tag) { | |
return $tag->getId(); | |
}, $tags); | |
$res = $this->connection->executeQuery( | |
'select offer_id from offer_tag where tag_id in (' . implode(',', $ids) . ')' | |
)->fetchAll(); | |
$offerIds = array_map(function ($row) { | |
return (int) $row['offer_id']; | |
}, $res); | |
$this->qb->andWhere($this->qb->expr()->in('o.id', $offerIds)); | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment