public function testFindOneWithMainAlias()
 {
     BookstoreDataPopulator::populate();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     $c = new ModelCriteria('bookstore', 'Book');
     $c->setModelAlias('b', true);
     $c->orderBy('b.Title');
     $c->join('b.Author a');
     $c->with('a');
     $c->join('b.Publisher p');
     $c->with('p');
     $this->assertCorrectHydration1($c, 'with main alias');
 }
Exemplo n.º 2
0
 public function testAddUsingAliasTrueAliasTwice()
 {
     $c1 = new ModelCriteria('bookstore', 'Book');
     $c1->setModelAlias('b', true);
     $c1->addUsingAlias(BookPeer::TITLE, 'foo');
     $c1->addUsingAlias(BookPeer::TITLE, 'bar');
     $c2 = new ModelCriteria('bookstore', 'Book');
     $c2->setModelAlias('b', true);
     $c2->add('b.TITLE', 'foo');
     $c2->addAnd('b.TITLE', 'bar');
     $this->assertEquals($c2, $c1, 'addUsingalias() translates to addAnd() when the table already has a condition on the column');
 }