本文整理匯總了PHP中OCP\Files\Folder::searchByTag方法的典型用法代碼示例。如果您正苦於以下問題:PHP Folder::searchByTag方法的具體用法?PHP Folder::searchByTag怎麽用?PHP Folder::searchByTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCP\Files\Folder
的用法示例。
在下文中一共展示了Folder::searchByTag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getFilesByTag
/**
* Updates the tags of the specified file path.
* The passed tags are absolute, which means they will
* replace the actual tag selection.
*
* @param array $tagName tag name to filter by
* @return FileInfo[] list of matching files
* @throws \Exception if the tag does not exist
*/
public function getFilesByTag($tagName)
{
$nodes = $this->homeFolder->searchByTag($tagName, $this->userSession->getUser()->getUId());
foreach ($nodes as &$node) {
$node = $node->getFileInfo();
}
return $nodes;
}
示例2: getFilesByTag
/**
* Updates the tags of the specified file path.
* The passed tags are absolute, which means they will
* replace the actual tag selection.
*
* @param array $tagName tag name to filter by
* @return FileInfo[] list of matching files
* @throws \Exception if the tag does not exist
*/
public function getFilesByTag($tagName)
{
$nodes = $this->homeFolder->searchByTag($tagName, $this->userSession->getUser()->getUId());
$fileInfos = [];
foreach ($nodes as $node) {
try {
/** @var \OC\Files\Node\Node $node */
$fileInfos[] = $node->getFileInfo();
} catch (\Exception $e) {
// FIXME Should notify the user, when this happens
// Can not get FileInfo, maybe the connection to the external
// storage is interrupted.
}
}
return $fileInfos;
}