当前位置: 首页>>代码示例>>PHP>>正文


PHP Criteria::_or方法代码示例

本文整理汇总了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);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:12,代码来源:CriteriaFluidOperatorTest.php

示例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');
 }
开发者ID:bondarovich,项目名称:Propel2,代码行数:42,代码来源:CriteriaMergeTest.php

示例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;
 }
开发者ID:project-a,项目名称:spryker-cms-block,代码行数:13,代码来源:CmsBlockQueryContainer.php


注:本文中的Propel\Runtime\ActiveQuery\Criteria::_or方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。