Skip to content

Instantly share code, notes, and snippets.

@wowo
Created November 8, 2011 10:16
Show Gist options
  • Save wowo/1347421 to your computer and use it in GitHub Desktop.
Save wowo/1347421 to your computer and use it in GitHub Desktop.
<?php
if (is_array($limiters['organization_unit']))
{
if (!empty($limiters['organization_unit']))
{
$units_conditions = '';
$first = true;
foreach($limiters['organization_unit'] as $value)
{
if ($first == false)
{
$units_conditions .= ' OR ';
}
$units_conditions .= 'si.organizationUnitCode = :unit'.$i;
array_push($units, $value);
$first = false;
$i++;
}
$query = $query->andWhere($units_conditions);
foreach ($units as $i => $val)
{
$query = $query->setParameter('unit' . $i, $units[$i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment