本文整理汇总了PHP中SelectQuery::distinct方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::distinct方法的具体用法?PHP SelectQuery::distinct怎么用?PHP SelectQuery::distinct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::distinct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_check_defines
public function action_check_defines()
{
if (!Component::isActive('BackendError')) {
return false;
}
$query = new SelectQuery('BackendError');
$query->distinct()->field('query')->filter("`string` LIKE 'Undefined index: %'")->filter("`file` LIKE '%\\\\Render.obj.php(%) : eval()\\'d code'")->filter("`query` LIKE 'a_p_i/define/%'");
return $query->fetchAll(array(), array('column' => 0));
}
示例2: read
public function read($options = array())
{
$result = parent::read($options);
if ($result) {
$query = new SelectQuery('Assignment');
$query->distinct()->field('`roles`.`name`')->leftJoin('Role', '`roles`.`id` = `assignments`.`role_id`')->filter("`assignments`.`access_type` = 'users'")->filter('`assignments`.`access_id` = :user_id OR `assignments`.`access_id` = 0')->order('`roles`.`name`');
$roles = $query->fetchAll(array(':user_id' => $this->getMeta('id')), array('column' => 0));
$roles = empty($roles) ? array() : $roles;
if ($this->object) {
$this->object->roles = $roles;
}
if ($this->array) {
$this->array['roles'] = $roles;
}
}
return $result;
}
示例3: get_permissions
public function get_permissions($component = false)
{
$toret = new stdClass();
//Base Permissions
$parameters = array();
$query = new SelectQuery('Permission');
$query->distinct()->field(array('action', 'subject'))->filter('`active` = 1')->filter('`subject_id` = 0')->group('`subject`, `action` WITH ROLLUP');
if ($component) {
$query->filter('`subject` = :component');
$parameters[':component'] = class_for_url($component);
}
$toret->base_perms = $query->fetchAll($parameters);
//Roles
$query = new SelectQuery('Role');
$query->filter('`active` = 1');
$toret->roles = $query->fetchAll();
//Activated Permissions
$parameters = array();
$query = new SelectQuery('Permission', array('fields' => "CONCAT(`subject`, '::', `action`), GROUP_CONCAT(DISTINCT `role` ORDER BY `role`) AS `roles`"));
$query->filter('`active` = 1')->filter('`subject_id` = 0')->filter("`role` != 'nobody'")->group('`subject`, `action`');
if ($component) {
$query->filter('`subject` = :component');
$parameters[':component'] = class_for_url($component);
}
$permissions = $query->fetchAll($parameters, array('with_key' => 1));
$toret->permissions = array();
foreach ($permissions as $key => $value) {
$toret->permissions[$key] = explode(',', current($value));
}
return $toret;
}
示例4: fillSelectQuery
/**
* @return SelectQuery
**/
public function fillSelectQuery(SelectQuery $query)
{
$query->limit($this->limit, $this->offset);
if ($this->distinct) {
$query->distinct();
}
if ($this->logic->getSize()) {
$query->andWhere($this->logic->toMapped($this->checkAndGetDao(), $query));
}
if ($this->order) {
$query->setOrderChain($this->order->toMapped($this->checkAndGetDao(), $query));
}
if ($this->projection->isEmpty() && $this->strategy->getId() != FetchStrategy::CASCADE) {
$this->joinProperties($query, $this->checkAndGetDao(), $this->checkAndGetDao()->getTable(), true);
}
return $query;
}