本文整理汇总了PHP中Propel\Runtime\ActiveQuery\Criteria::setIgnoreCase方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::setIgnoreCase方法的具体用法?PHP Criteria::setIgnoreCase怎么用?PHP Criteria::setIgnoreCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Runtime\ActiveQuery\Criteria
的用法示例。
在下文中一共展示了Criteria::setIgnoreCase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOrderByIgnoreCase
public function testOrderByIgnoreCase()
{
$originalDB = Propel::getServiceContainer()->getAdapter();
Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), new MysqlAdapter());
$criteria = new Criteria();
$criteria->setIgnoreCase(true);
$criteria->addAscendingOrderByColumn(BookTableMap::TITLE);
BookTableMap::addSelectColumns($criteria);
$params = array();
$sql = $criteria->createSelectSql($params);
$expectedSQL = 'SELECT book.ID, book.TITLE, book.ISBN, book.PRICE, book.PUBLISHER_ID, book.AUTHOR_ID, UPPER(book.TITLE) FROM `book` ORDER BY UPPER(book.TITLE) ASC';
$this->assertEquals($expectedSQL, $sql);
Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), $originalDB);
}
示例2: testBigIntIgnoreCaseOrderBy
public function testBigIntIgnoreCaseOrderBy()
{
BookstoreTableMap::doDeleteAll();
// Some sample data
$b = new Bookstore();
$b->setStoreName("SortTest1")->setPopulationServed(2000)->save();
$b = new Bookstore();
$b->setStoreName("SortTest2")->setPopulationServed(201)->save();
$b = new Bookstore();
$b->setStoreName("SortTest3")->setPopulationServed(302)->save();
$b = new Bookstore();
$b->setStoreName("SortTest4")->setPopulationServed(10000000)->save();
$c = new Criteria();
$c->setIgnoreCase(true);
$c->add(BookstoreTableMap::COL_STORE_NAME, 'SortTest%', Criteria::LIKE);
$c->addAscendingOrderByColumn(BookstoreTableMap::COL_POPULATION_SERVED);
$rows = BookstoreQuery::create(null, $c)->find();
$this->assertEquals('SortTest2', $rows[0]->getStoreName());
$this->assertEquals('SortTest3', $rows[1]->getStoreName());
$this->assertEquals('SortTest1', $rows[2]->getStoreName());
$this->assertEquals('SortTest4', $rows[3]->getStoreName());
}
示例3: testOrderByIgnoreCase
public function testOrderByIgnoreCase()
{
$originalDB = Propel::getServiceContainer()->getAdapter();
Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), new MysqlAdapter());
Propel::getServiceContainer()->setDefaultDatasource('bookstore');
$criteria = new Criteria();
$criteria->setIgnoreCase(true);
$criteria->addAscendingOrderByColumn(BookTableMap::COL_TITLE);
BookTableMap::addSelectColumns($criteria);
$params = [];
$sql = $criteria->createSelectSql($params);
$expectedSQL = 'SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id, UPPER(book.title) FROM book ORDER BY UPPER(book.title) ASC';
$this->assertEquals($expectedSQL, $sql);
Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), $originalDB);
}