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


PHP ContentModel::countBy方法代碼示例

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


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

示例1: countExistingTabSeparators

 /**
  * Count existing tab separators elements.
  *
  * @param \Database\Result $model  Current row.
  * @param Helper           $helper Wrapper helper.
  *
  * @return int
  */
 public function countExistingTabSeparators(\Database\Result $model, Helper $helper)
 {
     if ($helper->isTypeOf(Helper::TYPE_START)) {
         $modelId = $model->id;
     } else {
         $modelId = $model->bootstrap_parentId;
     }
     $number = \ContentModel::countBy('type=? AND bootstrap_parentId', array($helper->getTypeName(Helper::TYPE_SEPARATOR), $modelId));
     return $number;
 }
開發者ID:contao-bootstrap,項目名稱:components,代碼行數:18,代碼來源:Content.php

示例2: countRelatedElements

 /**
  * count related elements optionally limited by type
  *
  * @param Model $model
  * @param string $type
  * @return int
  */
 public static function countRelatedElements(Model $model, $type = null)
 {
     if ($model->getType() == $model::TYPE_START) {
         if ($type === null) {
             $column = 'bootstrap_parentId';
             $values = $model->id;
         } else {
             $column = array('bootstrap_parentId=?', 'type=?');
             $values = array($model->id, $model->getTypeName($type));
         }
     } elseif ($type === null) {
         $column = array('id !=?', '(bootstrap_parentId=? OR id=?)');
         $values = array($model->id, $model->bootstrap_parentId, $model->bootstrap_parentId);
     } elseif ($type == $model::TYPE_START) {
         $column = 'id';
         $values = $model->bootstrap_parentId;
     } else {
         $column = array('id !=?', 'bootstrap_parentId=?', 'type=?');
         $values = array($model->id, $model->bootstrap_parentId, $model->getTypeName($type));
     }
     return \ContentModel::countBy($column, $values);
 }
開發者ID:netzmacht,項目名稱:contao-bootstrap,代碼行數:29,代碼來源:Repository.php

示例3: countRelatedElements

 /**
  * Count related elements.
  *
  * @param string|null $type Name of the type. If empty current type is used.
  *
  * @return int
  */
 public function countRelatedElements($type = null)
 {
     $model = $this->model;
     if ($this->isTypeOf(static::TYPE_START)) {
         if ($type === null) {
             $column = array('bootstrap_parentId=?');
             $values = array($model->id);
         } else {
             $column = array('bootstrap_parentId=?', 'type=?');
             $values = array($model->id, $this->getTypeName($type));
         }
     } elseif ($type === null) {
         $column = array('id !=?', '(bootstrap_parentId=? OR id=?)');
         $values = array($model->id, $model->bootstrap_parentId, $model->bootstrap_parentId);
     } elseif ($type == static::TYPE_START) {
         $column = array('id=?');
         $values = array($model->bootstrap_parentId);
     } else {
         $column = array('id !=?', 'bootstrap_parentId=?', 'type=?');
         $values = array($model->id, $model->bootstrap_parentId, $this->getTypeName($type));
     }
     $column[] = 'invisible=?';
     $values[] = '';
     return \ContentModel::countBy($column, $values);
 }
開發者ID:contao-bootstrap,項目名稱:core,代碼行數:32,代碼來源:Helper.php

示例4: countExistingTabSeparators

 /**
  * count existing tab separators elements
  *
  * @param ContentWrapper\Model $model
  *
  * @return int
  */
 public function countExistingTabSeparators(ContentWrapper\Model $model)
 {
     $id = $model->getType() == ContentWrapper\Model::TYPE_START ? $model->id : $model->bootstrap_parentId;
     $number = \ContentModel::countBy('type=? AND bootstrap_parentId', array($model->getTypeName(ContentWrapper\Model::TYPE_SEPARATOR), $id));
     return $number;
 }
開發者ID:netzmacht,項目名稱:contao-bootstrap,代碼行數:13,代碼來源:Content.php


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