mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-03 06:55:03 +03:00
Исправление одновременной работы фильтров и #where (http://trac.lsdev.ru/livestreet/ticket/197)
This commit is contained in:
parent
da64a192e3
commit
b25127181a
|
@ -138,13 +138,6 @@ class MapperORM extends Mapper {
|
||||||
|
|
||||||
|
|
||||||
public function BuildFilter($aFilter,$oEntitySample) {
|
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();
|
$aFilterFields=array();
|
||||||
foreach ($aFilter as $k=>$v) {
|
foreach ($aFilter as $k=>$v) {
|
||||||
if (substr($k,0,1)=='#' || (is_string($v) && substr($v,0,1)=='#')) {
|
if (substr($k,0,1)=='#' || (is_string($v) && substr($v,0,1)=='#')) {
|
||||||
|
@ -168,6 +161,13 @@ class MapperORM extends Mapper {
|
||||||
$sFilterFields.=" and {$sFieldCurrent} {$sConditionCurrent} ? ";
|
$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);
|
return array($aFilterFields,$sFilterFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue