Exemplo n.º 1
0
 public function testFindOneWithMainAlias()
 {
     BookstoreDataPopulator::populate();
     BookTableMap::clearInstancePool();
     AuthorTableMap::clearInstancePool();
     $c = new ModelCriteria('bookstore', 'Propel\\Tests\\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');
 }
 public function testAddUsingAliasTrueAliasTwice()
 {
     $c1 = new ModelCriteria('bookstore', 'Propel\\Tests\\Bookstore\\Book');
     $c1->setModelAlias('b', true);
     $c1->addUsingAlias(BookTableMap::COL_TITLE, 'foo');
     $c1->addUsingAlias(BookTableMap::COL_TITLE, 'bar');
     $c2 = new ModelCriteria('bookstore', 'Propel\\Tests\\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');
 }