It's important to know how Criterion works, but in this particular case you'd better simply use IN operator :
$c = new Criteria(); $c->add(WeblogPeer::CATEGORY, array("general", "featured"), Criteria::IN); $c->add(WeblogPeer::ACTIVE, "0", Criteria::NOT_EQUAL); $c->addDescendingOrderByColumn(WeblogPeer::CREATED_AT); This is faster than a OR (even if, for two values, difference is neglictible), and above all it's very simplier to read ;) On 23 avr, 09:07, Lawrence Krubner <lkrub...@geocities.com> wrote: > Thanks much for this. I wish Criteria/Propel was better documented. > > On Apr 22, 11:40 pm, Dheeraj Kumar Aggarwal <dheerajcom...@gmail.com> > wrote: > > > hi > > i think this should work > > > $this->howManyToPage = 6; > > $c = new Criteria(); > > $criterion = $c->getNewCriterion(WeblogPeer::CATEGORY, 'general', > > Criteria::NOT_EQUAL); > > $criterion->addAnd($c->getNewCriterion(WeblogPeer::CATEGORY, 'featured', > > Criteria::NOT_EQUAL);); > > // $criterion->addOr($c->getNewCriterion(WeblogPeer::CATEGORY, 'featured', > > Criteria::NOT_EQUAL);); > > $c->add($criterion); > > $c->add(WeblogPeer::ACTIVE, "0", Criteria::NOT_EQUAL); > > $c->addDescendingOrderByColumn(WeblogPeer::CREATED_AT); > > $this->sendDataToPager("Weblog", $c); > > > On Thu, Apr 23, 2009 at 8:20 AM, Lawrence Krubner > > <lkrub...@geocities.com>wrote: > > > > I have this code: > > > > $this->howManyToPage = 6; > > > $c = new Criteria(); > > > $c->add(WeblogPeer::CATEGORY, "general", Criteria::NOT_EQUAL); > > > $c->add(WeblogPeer::CATEGORY, "featured", Criteria::NOT_EQUAL); > > > $c->add(WeblogPeer::ACTIVE, "0", Criteria::NOT_EQUAL); > > > $c->addDescendingOrderByColumn(WeblogPeer::CREATED_AT); > > > $this->sendDataToPager("Weblog", $c); > > > > I want to screen out all items that have a CATEGORY of 'general' or > > > 'equal'. The two lines that I have are acting more like an OR than an > > > AND. > > > > Also, where do I find the SQL that is actually executed by Propel, in > > > Symfony 1.2? In Symfony 1.1 All I had to do was look at my dev > > > controller and then click on the debugging "log" option up in the > > > right corner. That used to list the SQL that was actually executed. > > > But now there is no SQL there. Where do I look for it? > > > -- > > Regards, > > Dheeraj --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---