mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
fix: Migrate getById to getFirstNodeById
Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
parent
34c2125217
commit
315241fb44
1 changed files with 5 additions and 6 deletions
|
|
@ -136,9 +136,8 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation {
|
|||
if (!$this->event instanceof MapperEvent || $this->event->getObjectType() !== 'files') {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
$nodes = $this->root->getById((int)$this->event->getObjectId());
|
||||
if (is_array($nodes) && isset($nodes[0])) {
|
||||
$this->node = $nodes[0];
|
||||
$this->node = $this->root->getFirstNodeById((int)$this->event->getObjectId());
|
||||
if ($this->node !== null) {
|
||||
return $this->node;
|
||||
}
|
||||
break;
|
||||
|
|
@ -228,11 +227,11 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation {
|
|||
$this->eventName = $contextIDs['eventName'];
|
||||
if ($contextIDs['nodeOwnerId'] !== null) {
|
||||
$userFolder = $this->root->getUserFolder($contextIDs['nodeOwnerId']);
|
||||
$nodes = $userFolder->getById($contextIDs['nodeId']);
|
||||
$node = $userFolder->getFirstNodeById($contextIDs['nodeId']);
|
||||
} else {
|
||||
$nodes = $this->root->getById($contextIDs['nodeId']);
|
||||
$node = $this->root->getFirstNodeById($contextIDs['nodeId']);
|
||||
}
|
||||
$this->node = $nodes[0] ?? null;
|
||||
$this->node = $node;
|
||||
if ($contextIDs['actingUserId']) {
|
||||
$this->actingUser = $this->userManager->get($contextIDs['actingUserId']);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue