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