Filtering on fields 
espaan
/ Jan 12, 2012 / 01:27 ![]()
![]()
Hi, I asked some question to Axel by mail. I will post it here for others too
Normally MOST modules would be able to do this automatically. But this
filtering is blocked at the moment by https://github.com/zikula/core/issues/118
Hm this should work.
Another (probably more adequate) place to inject custom filters is the
repository class of the corresponding entity. Look at the
lib/YourModule/Entity/Repository/ folder. You can either override selectWhere,
selectWherePaginated or (most centrally) _intBaseQuery methods.
Here is an example:
$currentPage = 1, $resultsPerPage = 25, $useJoins = true)
{
$group = (int) FormUtil::getPassedValue('g', 2, 'GET');
if (!is_numeric($group) || ($group != 1 && $group != 2)) {
$group = 2;
}
if (!empty($where)) {
$where .= ' AND ';
}
$where .= 'tbl.addressGroup = \'' . DataUtil::formatForStore($group) .
'\'';
return parent::selectWherePaginated($where, $orderBy, $currentPage,
$resultsPerPage, $useJoins);
}</code>
Options
Rating
Replies
How to set up relations
- 8 Replies
- Axel on May 15, 2012 - 06:04
Neue Umfragen
You have not voted in the poll:
What should be improved in future?
What should be improved in future?
