本文整理匯總了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');
}
示例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');
}