本文整理汇总了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]);
}
}
}