Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: Git Master
-
Fix Version/s: None
-
Component/s: ORM
-
Security Level: All
-
Labels:None
Description
The SQLFilter currently only accepts string parameters which would result in SQL like:
"tableAlias.column = '$filterParameter'"
To filter an Entity that has a lifecycle, this can be usefull to filter Entities that are in a specific state, for example:
"tableAlias.state = 1"
To be able to apply the filter on an Entity that can be in multiple states, it is usefull to be able to assign an array of states using setParameter:
$allowedStates = array(1,2,3,4);
$filter->setParameter('allowedStatesParam', $allowedStates);
sprintf("tableAlias.state IN (%s)", implode(',', $this->getParameter('allowedStatesParam')));
to eventually result in:
"tableAlias.state IN (1,2,3,4)"
However, this is currently not supported, it seems to go wrong on the PDO::quote() of the parameter. The SQL works ok when setting it statically in the filter, not taking the parameter into account.
It would be nice to have support for arrays on the setParameter()