Created
September 17, 2013 14:00
-
-
Save benjaminrau/6594707 to your computer and use it in GitHub Desktop.
Set Orderings for an IN Statement
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
$query = $this->createQuery(); | |
$results = $query->matching($query->in('objectProfile.geoLocation', $geoLocations)); | |
# Sort by distance | |
if($geoLocations) { | |
foreach($geoLocations AS $geoLoc) { | |
$key = 'objectProfile.geoLocation = '.$geoLoc->getUid(); | |
$orderings[$key] = Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING; | |
} | |
$results = $results->setOrderings($orderings); | |
} | |
$results = $results->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment