Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Created September 17, 2013 14:00
Show Gist options
  • Save benjaminrau/6594707 to your computer and use it in GitHub Desktop.
Save benjaminrau/6594707 to your computer and use it in GitHub Desktop.
Set Orderings for an IN Statement
$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