當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Criteria::setAll方法代碼示例

本文整理匯總了PHP中Propel\Runtime\ActiveQuery\Criteria::setAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Criteria::setAll方法的具體用法?PHP Criteria::setAll怎麽用?PHP Criteria::setAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Propel\Runtime\ActiveQuery\Criteria的用法示例。


在下文中一共展示了Criteria::setAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDoubleSelectModifiers

 /**
  * Test whether calling setDistinct twice puts in two distinct keywords or not.
  * @link       http://propel.phpdb.org/trac/ticket/716
  */
 public function testDoubleSelectModifiers()
 {
     $c = new Criteria();
     $c->setDistinct();
     $this->assertEquals(array(Criteria::DISTINCT), $c->getSelectModifiers(), 'Initial setDistinct works');
     $c->setDistinct();
     $this->assertEquals(array(Criteria::DISTINCT), $c->getSelectModifiers(), 'Calling setDistinct again leaves a single distinct');
     $c->setAll();
     $this->assertEquals(array(Criteria::ALL), $c->getSelectModifiers(), 'All keyword is swaps distinct out');
     $c->setAll();
     $this->assertEquals(array(Criteria::ALL), $c->getSelectModifiers(), 'Calling setAll leaves a single all');
     $c->setDistinct();
     $this->assertEquals(array(Criteria::DISTINCT), $c->getSelectModifiers(), 'All back to distinct works');
     $c2 = new Criteria();
     $c2->setAll();
     $this->assertEquals(array(Criteria::ALL), $c2->getSelectModifiers(), 'Initial setAll works');
 }
開發者ID:robin850,項目名稱:Propel2,代碼行數:21,代碼來源:CriteriaTest.php

示例2: testMergeWithSelectModifiers

 public function testMergeWithSelectModifiers()
 {
     $c1 = new Criteria();
     $c1->setDistinct();
     $c2 = new Criteria();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::DISTINCT), $c1->getSelectModifiers(), 'mergeWith() does not remove an existing select modifier');
     $c1 = new Criteria();
     $c2 = new Criteria();
     $c2->setDistinct();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::DISTINCT), $c1->getSelectModifiers(), 'mergeWith() merges the select modifiers');
     $c1 = new Criteria();
     $c1->setDistinct();
     $c2 = new Criteria();
     $c2->setDistinct();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::DISTINCT), $c1->getSelectModifiers(), 'mergeWith() does not duplicate select modifiers');
     $c1 = new Criteria();
     $c1->setAll();
     $c2 = new Criteria();
     $c2->setDistinct();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::ALL), $c1->getSelectModifiers(), 'mergeWith() does not merge the select modifiers in case of conflict');
 }
開發者ID:bondarovich,項目名稱:Propel2,代碼行數:25,代碼來源:CriteriaMergeTest.php


注:本文中的Propel\Runtime\ActiveQuery\Criteria::setAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。