當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine_Query::groupBy方法代碼示例

本文整理匯總了PHP中Doctrine_Query::groupBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Query::groupBy方法的具體用法?PHP Doctrine_Query::groupBy怎麽用?PHP Doctrine_Query::groupBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine_Query的用法示例。


在下文中一共展示了Doctrine_Query::groupBy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: gallery

 /**
  * @param $filter
  */
 protected function gallery($filter)
 {
     if (!$this->_gallery_added) {
         $this->_query->leftJoin('f.Slices s');
         $this->_query->groupBy('f.id');
         $this->_gallery_added = true;
     }
     switch ($filter->operator) {
         case 'is':
             $s = $this->_slice_alias_count++;
             $this->_query->andWhere('f.id in (SELECT s' . $s . '.file_id FROM RokGallery_Model_Slice s' . $s . ' where s' . $s . '.gallery_id = ? GROUP BY s' . $s . '.file_id)', $filter->query);
             $this->_query->andWhere('s.gallery_id = ?', $filter->query);
             break;
         default:
     }
 }
開發者ID:atikahmed,項目名稱:joomla-probid,代碼行數:19,代碼來源:MainPageFilter.php

示例2: queryTagsWithCountsByModel

 /**
  * Retrieves tags with the number of taggings for a given set of models, can be accessed using ->$model
  *
  * @param Array $models
  * @param Doctrine_Query $q
  * @return Doctrine_Query
  */
 public function queryTagsWithCountsByModel($models, $q = null)
 {
     $q->leftJoin('r.Tagging tg')->addSelect('r.*');
     foreach ($models as $model) {
         $q->addSelect("SUM(IF(tg.taggable_model = '{$model}' , 1, 0)) AS " . $model . "Count");
     }
     $q->groupBy('r.id');
     return $q;
 }
開發者ID:nixilla,項目名稱:sfDoctrineActAsTaggablePlugin,代碼行數:16,代碼來源:PluginTagTable.class.php

示例3: testCountWithGroupBy

 public function testCountWithGroupBy()
 {
     $q = new Doctrine_Query();
     $q->from('User u');
     $q->leftJoin('u.Phonenumber p');
     $q->groupBy('p.entity_id');
     $this->assertEqual($q->count(), $q->execute()->count());
 }
開發者ID:kaakshay,項目名稱:audience-insight-repository,代碼行數:8,代碼來源:QueryTestCase.php


注:本文中的Doctrine_Query::groupBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。