本文整理汇总了PHP中DataObjectSet::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectSet::remove方法的具体用法?PHP DataObjectSet::remove怎么用?PHP DataObjectSet::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectSet
的用法示例。
在下文中一共展示了DataObjectSet::remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContextNav
function getContextNav() {
if($this->ID > 0) {
$pages = new DataObjectSet();
$pages->push($this->Parent());
$pages->merge($this->getPagesBySibling());
$pages->merge($this->getPagesByKeyword());
$pages->merge($this->getPagesByBlogTags());
$pages->merge($this->getPagesByReferer());
$pages->removeDuplicates();
$currentPage = $pages->find('ID', $this->ID);
if($currentPage) $pages->remove($currentPage);
return $pages;
} else {
return false;
}
}
示例2: get_by_publisher
public static function get_by_publisher($class, $publisher, $status = null)
{
// To ensure 2.3 and 2.4 compatibility
$bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
if ($status) {
$statusStr = "'" . implode("','", $status) . "'";
}
$classes = (array) ClassInfo::subclassesFor($class);
$classesSQL = implode("','", $classes);
// build filter
$filter = "{$bt}WorkflowRequest{$bt}.{$bt}ClassName{$bt} IN ('{$classesSQL}') ";
if ($status) {
$filter .= "AND {$bt}WorkflowRequest{$bt}.{$bt}Status{$bt} IN (" . $statusStr . ")";
}
$onDraft = Versioned::get_by_stage("SiteTree", "Stage", $filter, "{$bt}SiteTree{$bt}.{$bt}LastEdited{$bt} DESC", "LEFT JOIN {$bt}WorkflowRequest{$bt} ON {$bt}WorkflowRequest{$bt}.{$bt}PageID{$bt} = {$bt}SiteTree{$bt}.{$bt}ID{$bt} ");
$onLive = Versioned::get_by_stage("SiteTree", "Live", $filter, "{$bt}SiteTree_Live{$bt}.{$bt}LastEdited{$bt} DESC", "LEFT JOIN {$bt}WorkflowRequest{$bt} ON {$bt}WorkflowRequest{$bt}.{$bt}PageID{$bt} = {$bt}SiteTree_Live{$bt}.{$bt}ID{$bt} ");
$return = new DataObjectSet();
$return->merge($onDraft);
$return->merge($onLive);
$return->removeDuplicates();
$canPublish = SiteTree::batch_permission_check($return->column('ID'), $publisher->ID, 'CanPublishType', 'SiteTree_PublisherGroups', 'canPublish');
foreach ($return as $page) {
if (!isset($canPublish[$page->ID]) || !$canPublish[$page->ID]) {
$return->remove($page);
}
}
return $return;
}