本文整理汇总了PHP中Propel\Runtime\ActiveQuery\Criteria::_or方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::_or方法的具体用法?PHP Criteria::_or怎么用?PHP Criteria::_or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Runtime\ActiveQuery\Criteria
的用法示例。
在下文中一共展示了Criteria::_or方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testaddUsingOperatorResetsDefaultOperator
public function testaddUsingOperatorResetsDefaultOperator()
{
$c = new Criteria();
$c->addUsingOperator('foo1', 'bar1');
$c->_or();
$c->addUsingOperator('foo2', 'bar2');
$c->addUsingOperator('foo3', 'bar3');
$expected = 'SELECT FROM WHERE (foo1=:p1 OR foo2=:p2) AND foo3=:p3';
$params = array();
$result = $c->createSelectSql($params);
$this->assertEquals($expected, $result);
}
示例2: testMerge_OrWithWhereConditions
public function testMerge_OrWithWhereConditions()
{
$c1 = new Criteria();
$c1->add(BookTableMap::COL_TITLE, 'foo');
$c2 = new Criteria();
$c1->_or();
$c1->mergeWith($c2);
$sql = $this->getSql('SELECT FROM `book` WHERE book.TITLE=:p1');
$this->assertCriteriaTranslation($c1, $sql, 'mergeWith() does not remove an existing where condition');
$c1 = new Criteria();
$c2 = new Criteria();
$c2->add(BookTableMap::COL_TITLE, 'foo');
$c1->_or();
$c1->mergeWith($c2);
$sql = $this->getSql('SELECT FROM `book` WHERE book.TITLE=:p1');
$this->assertCriteriaTranslation($c1, $sql, 'mergeWith() merges where condition to an empty condition');
$c1 = new Criteria();
$c1->add(BookTableMap::COL_ID, 123);
$c1->_or();
$c2 = new Criteria();
$c2->add(BookTableMap::COL_TITLE, 'foo');
$c1->mergeWith($c2);
$sql = $this->getSql('SELECT FROM `book` WHERE (book.ID=:p1 OR book.TITLE=:p2)');
$this->assertCriteriaTranslation($c1, $sql, 'mergeWith() merges where condition to existing conditions');
$c1 = new Criteria();
$c1->add(BookTableMap::COL_TITLE, 'foo');
$c1->_or();
$c2 = new Criteria();
$c2->add(BookTableMap::COL_TITLE, 'bar');
$c1->mergeWith($c2);
$sql = $this->getSql('SELECT FROM `book` WHERE (book.TITLE=:p1 OR book.TITLE=:p2)');
$this->assertCriteriaTranslation($c1, $sql, 'mergeWith() merges where condition to existing conditions on the same column');
$c1 = new Criteria();
$c1->add(BookTableMap::COL_TITLE, 'foo');
$c1->addJoin(BookTableMap::COL_AUTHOR_ID, AuthorTableMap::COL_ID, Criteria::LEFT_JOIN);
$c1->_or();
$c2 = new Criteria();
$c2->add(AuthorTableMap::COL_FIRST_NAME, 'bar');
$c1->mergeWith($c2);
$sql = $this->getSql('SELECT FROM `book` LEFT JOIN `author` ON (book.AUTHOR_ID=author.ID) WHERE (book.TITLE=:p1 OR author.FIRST_NAME=:p2)');
$this->assertCriteriaTranslation($c1, $sql, 'mergeWith() merges where condition to existing conditions on the different tables');
}
示例3: getLocaleCriteria
/**
* @param \Generated\Shared\Transfer\LocaleTransfer $localeTransfer
*
* @return \Propel\Runtime\ActiveQuery\Criteria
*/
protected function getLocaleCriteria(LocaleTransfer $localeTransfer)
{
$localeCriteria = new Criteria();
$localeCriteria->addAnd(PavCmsLocalizedBlockTableMap::COL_FK_LOCALE, $localeTransfer->getIdLocale(), Criteria::EQUAL);
$localeCriteria->_or();
$localeCriteria->addAnd(PavCmsLocalizedBlockTableMap::COL_ID_CMS_LOCALIZED_BLOCK, null, Criteria::ISNULL);
return $localeCriteria;
}