本文整理匯總了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();
}