combine replaces previous conditions added by filterby #450

merged 2 commits into from Oct 22, 2012


None yet

4 participants


No description provided.


This pull request passes (merged 740d8ff into 441f969).

Propel member


Could you write a unit test to prove both your fix and the bug?

Propel member

ping @hholzer



we sadly don't have any experience with unit tests yet, so it's probably for the best if we simply explain the problem a bit more, so that you can reproduce it by yourself

we have a pretty complex application with a behavior wo filters rows automatically by user credentials

our behavior adds the filter by credential method wich does something like this and it's called in preSelectQuery

$this->condition('user_type', ...);
$this->condition('credential', ...);
$this->condition('user_type2', ...);
$this->combine(array('user_type', 'credential'), 'and', 'user_type_credential');
$this->combine(array('user_type_credential', 'user_type2'), 'or');

now we have the use case that we want to filter the list a bit more wich works for filterByUsername fine ... but not for ->filterByUserType because it would be overridden by the combine.

if we would use first the combine and the filterByXXX after it would work because filterByXXX seems to use Criteria::addAnd while combine uses Criteria::add

kind regards



i can confirm the issue and i wrote a unit test wich should prove that a filterByXXX before a combine gets overriden instead of added while a filterByXXX after a combine gets correclty added.

The unit test should fail without the first commit of @hholzer and work afterwards

kind regards

@willdurand willdurand merged commit 51983e4 into propelorm:master Oct 22, 2012

1 check passed

Details default The Travis build passed
Propel member

Great, thank you!

@willdurand willdurand referenced this pull request in propelorm/Propel2 Oct 22, 2012

Port PR #450 from Propel 1.6 #311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment