When using multiple conditions on the same column you need to use a criterion that links them together otherwise the last defined filtering criteria is taken into consideration.
Using your example something like this: $c = new Criteria(); $c1 = $c- >getNewCriterion((CommentsPeer::COMMENT,'likes',Criteria::NOT_LIKE); $c2 = $c->getNewCriterion(CommentsPeer::COMMENT,'%likes %',Criteria::NOTLIKE); $c1->addAnd($c2); $c->add($c1); gabriel On Oct 26, 3:16 am, Parijat Kalia <kaliapari...@gmail.com> wrote: > Hey guys, trying to implement a criteria for my sql query which has a not > like clause in it. > this is how I proceed: > > $c->add(CommentsPeer::COMMENT,'likes',Criteria::NOTLIKE); > > I have also carried out trial and error with the following: > > $c->add(CommentsPeer::COMMENT,'likes',Criteria::NOT_LIKE); > $c->add(CommentsPeer::COMMENT,'%likes%',Criteria::NOTLIKE); > $c->add(CommentsPeer::COMMENT,'%likes%',Criteria::NOT_LIKE); > > also made use of not_equal > > $$c->add(CommentsPeer::COMMENT,'likes',Criteria::NOTEQUAL); > $c->add(CommentsPeer::COMMENT,'likes',Criteria::NOT_EQUAL); > > None of these work, neither are they causing any background errors in the > action within which they are called. Yet they always yield the 'likes' query > in the results. > > Not sure what I am doing wrong here, would anybody like to point out any > errors? > > Regards, > > Parijat Kalia -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en