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


PHP Doctrine_Query::count方法代码示例

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


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

示例1: count

 /**
  * Count results
  *
  * @return int
  */
 public function count()
 {
     if ($this->_rowCount === null) {
         $this->_rowCount = $this->_query->count();
     }
     return $this->_rowCount;
 }
开发者ID:lciolecki,项目名称:zf-doctrine,代码行数:12,代码来源:DoctrineQuery.php

示例2: getTotalRecords

 /**
  * Return the total of records
  *
  * @return integer
  */
 public function getTotalRecords()
 {
     if ($this->_totalRecords > 0) {
         return $this->_totalRecords;
     }
     return (int) $this->_query->count();
 }
开发者ID:ocpyosep78,项目名称:Booking,代码行数:12,代码来源:Doctrine.php

示例3: count

 public function count($params = array())
 {
     $breadcrumb = $this->getBreadcrumb();
     $result = parent::count($params);
     $this->restoreBreadcrumb($breadcrumb);
     return $result;
 }
开发者ID:JoshuaEstes,项目名称:sfDoctrineExtraPlugin,代码行数:7,代码来源:Query.php

示例4: getTotalRecords

 /**
  * Return the total of records
  *
  * @return integer
  */
 public function getTotalRecords()
 {
     return (int) $this->_query->count();
 }
开发者ID:robjacoby,项目名称:xlr8u,代码行数:9,代码来源:Doctrine.php

示例5: getRecords

 /**
  * getRecords
  * Get records from the DB
  * @return mixed
  */
 public function getRecords(Doctrine_Query $dq, $currentPage = 1, $rowNum = 2, array $sort = array(), array $where = array())
 {
     $uri = "";
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     // Defining the url sort
     if (!empty($sort)) {
         foreach ($sort as $s) {
             $arrSort[] = "/sort/" . str_replace(" ", ",", $s);
         }
         $arrSort = array_unique($arrSort);
         $uri = implode("", $arrSort);
     }
     $pagerLayout = new Doctrine_Pager_Layout(new Doctrine_Pager($dq, $currentPage, $rowNum), new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), "/{$module}/{$controller}/list/page/{%page_number}" . $uri);
     // Get the pager object
     $pager = $pagerLayout->getPager();
     // Set the Order criteria
     if (!empty($sort)) {
         $pager->getQuery()->orderBy(implode(", ", $sort));
     }
     if (isset($where) && is_array($where)) {
         foreach ($where as $filters) {
             if (isset($filters[0]) && is_array($filters[0])) {
                 foreach ($filters as $filter) {
                     $method = $filter['method'];
                     $value = $filter['value'];
                     $criteria = $filter['criteria'];
                     $pager->getQuery()->{$method}($criteria, $value);
                 }
             } else {
                 $method = $filters['method'];
                 $value = $filters['value'];
                 $criteria = $filters['criteria'];
                 $pager->getQuery()->{$method}($criteria, $value);
             }
         }
     }
     $pagerLayout->setTemplate('<a href="{%url}">{%page}</a> ');
     $pagerLayout->setSelectedTemplate('<a class="active" href="{%url}">{%page}</a> ');
     $this->data = $pagerLayout->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     $this->paging = $pagerLayout->display(null, true);
     $this->recordcount = $dq->count();
     #print_r ( $this->data );
     return $this;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:50,代码来源:Datagrid.php

示例6: testAggregateFunctionsInOrderByAndHavingWithCount

 public function testAggregateFunctionsInOrderByAndHavingWithCount()
 {
     $q = new Doctrine_Query();
     
     $q->select('u.*, COUNT(a.id) num_albums')
       ->from('User u')
       ->leftJoin('u.Album a')
       ->orderby('num_albums desc')
       ->groupby('u.id')
       ->having('num_albums > 0')
       ->limit(5);
     
     try {
         $q->count();
         $this->pass();
     } catch (Doctrine_Exception $e) {
         $this->fail();
     }
 }
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:19,代码来源:SubqueryTestCase.php

示例7: 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

示例8: testAggregateFunctionsInOrderByAndHavingWithCount

 public function testAggregateFunctionsInOrderByAndHavingWithCount()
 {
     $q = new Doctrine_Query();
     $q->select('u.*, COUNT(a.id) num_albums')->from('User u')->leftJoin('u.Album a')->orderby('num_albums desc')->groupby('u.id')->having('num_albums > 0')->limit(5);
     try {
         $this->assertEqual($q->getCountQuery(), 'SELECT COUNT(*) AS num_results FROM (SELECT e.id, COUNT(a.id) AS a__0 FROM entity e LEFT JOIN album a ON e.id = a.user_id WHERE e.type = 0 GROUP BY e.id HAVING a__0 > 0) dctrn_count_query');
         $q->count();
         $this->pass();
     } catch (Doctrine_Exception $e) {
         $this->fail($e->getMessage());
     }
 }
开发者ID:ninjapenguin,项目名称:kohana-Doctrine-module,代码行数:12,代码来源:SubqueryTestCase.php

示例9: rec_query_total

 /**
  * Get total from a Doctrine_Query object.
  *
  * @param Doctrine_Query $q
  * @return int  $total
  */
 protected function rec_query_total(Doctrine_Query $q)
 {
     return $q->count();
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:DOCframe_Resource.php

示例10: count

 /**
  * Get the item count
  * 
  * @return integer
  */
 public function count()
 {
     return $this->_query->count();
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:9,代码来源:Doctrine.php


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