public function testQWithJoinConditionsPQ() { $thing = new Thing(); $thing->hasMany('deleted_foos', array('default_strategy' => 'Pfw_Associate_PostQuery', 'table' => 'foos', 'class' => 'Foo', 'conditions' => 'deleted_foos.is_deleted = 1')); $thing->name = 'pete'; $thing->save(); $foo = new Foo(); $foo->name = 'sammy'; $foo->is_deleted = 0; $thing->associateWith($foo); $thing = new Thing(); $thing->name = 'kristin'; $thing->save(); $f1 = new Foo(); $f1->name = 'dave'; $f1->is_deleted = 1; $thing->associateWith($f1); $f2 = new Foo(); $f2->name = 'kate'; $f2->is_deleted = 1; $thing->associateWith($f2); $things = Thing::Q()->with('deleted_foos')->exec(); foreach ($things as $thing) { $this->assertTrue(is_a($thing, 'Thing')); } $this->assertTrue(is_array($things[0]->deleted_foos)); $this->assertTrue(empty($things[0]->deleted_foos)); $this->assertEquals(2, count($things[1]->deleted_foos)); $this->assertEquals($f1->id, $things[1]->deleted_foos[0]->id); $this->assertEquals($f2->id, $things[1]->deleted_foos[1]->id); }