当前位置: 首页>>代码示例>>PHP>>正文


PHP DbCommand::setGroup方法代码示例

本文整理汇总了PHP中DbCommand::setGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP DbCommand::setGroup方法的具体用法?PHP DbCommand::setGroup怎么用?PHP DbCommand::setGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbCommand的用法示例。


在下文中一共展示了DbCommand::setGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: modifyElementsQuery

 /**
  * Modifies an element query targeting elements of this type.
  *
  * @param DbCommand            $query
  * @param ElementCriteriaModel $criteria
  *
  * @return mixed
  */
 public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)
 {
     // Default query
     $query->select('id, currentStep, totalSteps, status, type, description, settings, dateCreated')->from('tasks elements');
     // Reset default element type query parts
     $query->setJoin('');
     $query->setWhere('1=1');
     $query->setGroup('');
     unset($query->params[':locale']);
     unset($query->params[':elementsid1']);
     if ($criteria->type) {
         $query->andWhere(DbHelper::parseParam('type', $criteria->type, $query->params));
     }
     // Add search capabilities
     if ($criteria->search) {
         $query->andWhere(DbHelper::parseParam('description', '*' . $criteria->search . '*', $query->params));
         $criteria->search = null;
     }
 }
开发者ID:webremote,项目名称:taskmanager,代码行数:27,代码来源:TaskManagerElementType.php

示例2: modifyElementsQuery

 /**
  * Modify the elements query.
  *
  * @param DbCommand            $query
  * @param ElementCriteriaModel $criteria
  */
 public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)
 {
     // Default query
     $query->select('auditlog.id, auditlog.type, auditlog.userId, auditlog.origin, auditlog.before, auditlog.after, auditlog.status, auditlog.dateCreated, auditlog.dateUpdated')->from('auditlog auditlog');
     // Reset default element type query parts
     $query->setJoin('');
     $query->setWhere('1=1');
     $query->setGroup('');
     unset($query->params[':locale']);
     unset($query->params[':elementsid1']);
     // Check for specific id
     if (!empty($criteria->id)) {
         $query->andWhere(DbHelper::parseParam('auditlog.id', $criteria->id, $query->params));
     }
     // Check type
     if (!empty($criteria->type)) {
         $query->andWhere(DbHelper::parseParam('auditlog.type', $criteria->type, $query->params));
     }
     // Check user id
     if (!empty($criteria->userId)) {
         $query->andWhere(DbHelper::parseParam('auditlog.userId', $criteria->userId, $query->params));
     }
     // Check origin
     if (!empty($criteria->origin)) {
         $query->andWhere(DbHelper::parseParam('auditlog.origin', $criteria->origin, $query->params));
     }
     // Check before
     if (!empty($criteria->before)) {
         $query->andWhere(DbHelper::parseParam('auditlog.before', $criteria->before, $query->params));
     }
     // Check after
     if (!empty($criteria->after)) {
         $query->andWhere(DbHelper::parseParam('auditlog.after', $criteria->after, $query->params));
     }
     // Check for status
     if (!empty($criteria->status)) {
         $query->andWhere(DbHelper::parseParam('auditlog.status', $criteria->status, $query->params));
     }
     // Dates
     $this->applyDateCriteria($criteria, $query);
     // Search
     $this->applySearchCriteria($criteria, $query);
 }
开发者ID:boboldehampsink,项目名称:auditlog,代码行数:49,代码来源:AuditLogElementType.php

示例3: modifyElementsQuery

 /**
  * Cancel the elements query.
  *
  * @param DbCommand            $query
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria)
 {
     // Default query
     $query->select('auditlog.id, auditlog.type, auditlog.userId, auditlog.origin, auditlog.before, auditlog.after, auditlog.status, auditlog.dateCreated, auditlog.dateUpdated')->from('auditlog auditlog');
     // Reset default element type query parts
     $query->setJoin('');
     $query->setWhere('1=1');
     $query->setGroup('');
     unset($query->params[':locale']);
     unset($query->params[':elementsid1']);
     // Check for specific id
     if (!empty($criteria->id)) {
         $query->andWhere(DbHelper::parseParam('auditlog.id', $criteria->id, $query->params));
     }
     // Check type
     if (!empty($criteria->type)) {
         $query->andWhere(DbHelper::parseParam('auditlog.type', $criteria->type, $query->params));
     }
     // Check user id
     if (!empty($criteria->userId)) {
         $query->andWhere(DbHelper::parseParam('auditlog.userId', $criteria->userId, $query->params));
     }
     // Check origin
     if (!empty($criteria->origin)) {
         $query->andWhere(DbHelper::parseParam('auditlog.origin', $criteria->origin, $query->params));
     }
     // Check for date modified
     if (!empty($criteria->modified)) {
         $query->andWhere(DbHelper::parseDateParam('auditlog.dateUpdated', $criteria->modified, $query->params));
     }
     // Check before
     if (!empty($criteria->before)) {
         $query->andWhere(DbHelper::parseParam('auditlog.before', $criteria->before, $query->params));
     }
     // Check after
     if (!empty($criteria->after)) {
         $query->andWhere(DbHelper::parseParam('auditlog.after', $criteria->after, $query->params));
     }
     // Check for date from
     if (!empty($criteria->from)) {
         $query->andWhere(DbHelper::parseDateParam('auditlog.dateUpdated', '>= ' . DateTimeHelper::formatTimeForDb($criteria->from), $query->params));
     }
     // Check for date to
     if (!empty($criteria->to)) {
         $criteria->to->add(new DateInterval('PT23H59M59S'));
         $query->andWhere(DbHelper::parseDateParam('auditlog.dateUpdated', '<= ' . DateTimeHelper::formatTimeForDb($criteria->to), $query->params));
     }
     // Check for type
     if (!empty($criteria->type)) {
         $query->andWhere(DbHelper::parseParam('auditlog.type', $criteria->type, $query->params));
     }
     // Check for status
     if (!empty($criteria->status)) {
         $query->andWhere(DbHelper::parseParam('auditlog.status', $criteria->status, $query->params));
     }
     // Search
     if (!empty($criteria->search)) {
         // Always perform a LIKE search
         $criteria->search = '*' . $criteria->search . '*';
         // Build conditions
         $conditions = array('or', DbHelper::parseParam('auditlog.origin', $criteria->search, $query->params), DbHelper::parseParam('auditlog.before', $criteria->search, $query->params), DbHelper::parseParam('auditlog.after', $criteria->search, $query->params));
         // Add to query
         $query->andWhere($conditions, $query->params);
         // Don't perform search logics after this
         $criteria->search = null;
     }
 }
开发者ID:webremote,项目名称:auditlog,代码行数:75,代码来源:AuditLogElementType.php


注:本文中的DbCommand::setGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。