1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00

Исправление одновременной работы фильтров и #where (http://trac.lsdev.ru/livestreet/ticket/197)

This commit is contained in:
kirsan 2011-04-19 12:49:13 +00:00
parent da64a192e3
commit b25127181a

View file

@ -138,13 +138,6 @@ class MapperORM extends Mapper {
public function BuildFilter($aFilter,$oEntitySample) {
if (isset($aFilter['#where']) and is_array($aFilter['#where'])) {
// '#where' => array('id = ?d OR name = ?' => array(1,'admin'));
foreach ($aFilter['#where'] as $sFilterFields => $aValues) {
return array($aValues,' and '. trim($sFilterFields) .' '); // возвращает первый элемент
}
}
$aFilterFields=array();
foreach ($aFilter as $k=>$v) {
if (substr($k,0,1)=='#' || (is_string($v) && substr($v,0,1)=='#')) {
@ -168,6 +161,13 @@ class MapperORM extends Mapper {
$sFilterFields.=" and {$sFieldCurrent} {$sConditionCurrent} ? ";
}
}
if (isset($aFilter['#where']) and is_array($aFilter['#where'])) {
// '#where' => array('id = ?d OR name = ?' => array(1,'admin'));
foreach ($aFilter['#where'] as $sFilterKey => $aValues) {
$aFilterFields = array_merge($aFilterFields, $aValues);
$sFilterFields .= ' and '. trim($sFilterKey) .' ';
}
}
return array($aFilterFields,$sFilterFields);
}