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


PHP entity_selector::get_count方法代碼示例

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


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

示例1: foreach

 /**
  * Gets the number of entities a query of one type will return
  * @param string $status Either Live, Pending, Archived... (optional)
  * @param int $type type_id (or blank for default)
  * @return int number of results
  */
 function get_one_count($status = 'Live', $type = '')
 {
     if (!$type) {
         if ($this->type[0]) {
             $type = $this->type[0];
         } else {
             return 0;
         }
     }
     $new_e = new entity_selector($this->site_id);
     $sharing = '';
     if ($this->owns) {
         $sharing .= 'owns';
     }
     if ($this->borrows) {
         $sharing .= 'borrows';
     }
     $new_e->swallow(get_entities_by_type_object($type, $this->site_id, $sharing));
     $new_e->swallow($this);
     if ($status != 'All') {
         $new_e->add_relation('entity.state = "' . $status . '"');
     } else {
         $new_e->add_relation('entity.state != "Archived"');
     }
     if ($this->union) {
         $key_search = array_flip($new_e->fields);
         foreach ($this->diff['fields'] as $k => $union) {
             $new_e->fields = array_diff($new_e->fields, $this->diff['fields'][$k]);
             $new_e->tables = array_diff_assoc($new_e->tables, $this->diff['tables'][$k]);
             $new_e->relations = array_diff($new_e->relations, $this->diff['relations'][$k]);
         }
     }
     return $new_e->get_count();
 }
開發者ID:natepixel,項目名稱:reason_package,代碼行數:40,代碼來源:entity_selector.php


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