本文整理匯總了PHP中Doctrine_Query::distinct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Query::distinct方法的具體用法?PHP Doctrine_Query::distinct怎麽用?PHP Doctrine_Query::distinct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine_Query
的用法示例。
在下文中一共展示了Doctrine_Query::distinct方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSelectDistinctIsSupported
public function testSelectDistinctIsSupported()
{
$q = new Doctrine_Query();
$q->distinct()->select('u.name')->from('User u');
$this->assertEqual($q->getSql(), "SELECT DISTINCT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)");
}
示例2: modifyImpl
/**
* @access private
*
* @author Jannis Moßhammer <jannis.mosshammer@netways.de>
**/
protected function modifyImpl(Doctrine_Query &$o)
{
$o->setAliasDefs($this->mainAlias, $this->aliasDefs);
$o->setDefaultJoinType($this->defaultJoinType);
foreach ($this->fields as $field) {
$o->addSelect($field);
}
$o->distinct($this->isDistinct());
$o->from($this->target . " " . $this->mainAlias);
foreach ($this->staticWhereConditions as $cond) {
if (isset($cond[1]) && $cond[1] != null) {
$o->addWhere($cond[0], $cond[1]);
} else {
$o->addWhere($cond[0]);
}
}
}