本文整理汇总了PHP中PhabricatorOwnersPackage::loadOwningPackages方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorOwnersPackage::loadOwningPackages方法的具体用法?PHP PhabricatorOwnersPackage::loadOwningPackages怎么用?PHP PhabricatorOwnersPackage::loadOwningPackages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorOwnersPackage
的用法示例。
在下文中一共展示了PhabricatorOwnersPackage::loadOwningPackages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queryByPath
private static function queryByPath($repo_callsign, $path)
{
$repository = id(new PhabricatorRepository())->loadOneWhere('callsign = %s', $repo_callsign);
if (empty($repository)) {
throw id(new ConduitException('ERR_REP_NOT_FOUND'))->setErrorDescription('Repository callsign ' . $repo_callsign . ' not recognized');
}
return PhabricatorOwnersPackage::loadOwningPackages($repository, $path);
}
示例2: queryByPath
private static function queryByPath(PhabricatorUser $viewer, $repo_callsign, $path)
{
$repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withCallsigns(array($repo_callsign))->executeOne();
if (!$repository) {
throw id(new ConduitException('ERR_REP_NOT_FOUND'))->setErrorDescription(pht('Repository callsign %s not recognized', $repo_callsign));
}
if ($path == null) {
return PhabricatorOwnersPackage::loadPackagesForRepository($repository);
} else {
return PhabricatorOwnersPackage::loadOwningPackages($repository, $path);
}
}
示例3: execute
protected function execute(ConduitAPIRequest $request)
{
$repository = id(new PhabricatorRepository())->loadOneWhere('callsign = %s', $request->getValue('repositoryCallsign'));
if (empty($repository)) {
throw new ConduitException('ERR_REP_NOT_FOUND');
}
$packages = PhabricatorOwnersPackage::loadOwningPackages($repository, $request->getValue('path'));
if (empty($packages)) {
throw new ConduitException('ERR_PATH_NOT_FOUND');
}
$result = array();
foreach ($packages as $package) {
$p_owners = id(new PhabricatorOwnersOwner())->loadAllForPackages(array($package));
$result[] = array('phid' => $package->getPHID(), 'name' => $package->getName(), 'primaryOwner' => $package->getPrimaryOwnerPHID(), 'owners' => array_values(mpull($p_owners, 'getUserPHID')));
}
return $result;
}