本文整理汇总了PHP中PhabricatorProject::loadAffiliations方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorProject::loadAffiliations方法的具体用法?PHP PhabricatorProject::loadAffiliations怎么用?PHP PhabricatorProject::loadAffiliations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorProject
的用法示例。
在下文中一共展示了PhabricatorProject::loadAffiliations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderPeoplePage
private function renderPeoplePage(PhabricatorProject $project, PhabricatorProjectProfile $profile)
{
$affiliations = $project->loadAffiliations();
$phids = mpull($affiliations, 'getUserPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$affiliated = array();
foreach ($affiliations as $affiliation) {
$user = $handles[$affiliation->getUserPHID()]->renderLink();
$role = phutil_escape_html($affiliation->getRole());
$affiliated[] = '<li>' . $user . ' — ' . $role . '</li>';
}
if ($affiliated) {
$affiliated = '<ul>' . implode("\n", $affiliated) . '</ul>';
} else {
$affiliated = '<p><em>No one is affiliated with this project.</em></p>';
}
return '<div class="phabricator-profile-info-group">' . '<h1 class="phabricator-profile-info-header">People</h1>' . '<div class="phabricator-profile-info-pane">' . $affiliated . '</div>' . '</div>';
}
示例2: setTransactionOldValue
private function setTransactionOldValue(PhabricatorProject $project, PhabricatorProjectTransaction $xaction)
{
$type = $xaction->getTransactionType();
switch ($type) {
case PhabricatorProjectTransactionType::TYPE_NAME:
$xaction->setOldValue($project->getName());
break;
case PhabricatorProjectTransactionType::TYPE_STATUS:
$xaction->setOldValue($project->getStatus());
break;
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
$affils = $project->loadAffiliations();
$project->attachAffiliations($affils);
$old_value = mpull($affils, 'getUserPHID');
$old_value = array_values($old_value);
$xaction->setOldValue($old_value);
$new_value = $xaction->getNewValue();
$new_value = array_filter($new_value);
$new_value = array_unique($new_value);
$new_value = array_values($new_value);
$xaction->setNewValue($new_value);
break;
default:
throw new Exception("Unknown transaction type '{$type}'!");
}
return $this;
}