Skip to content

Commit 3534056

Browse files
committed
fix: Migrate getById to getFirstNodeById
Signed-off-by: Louis Chmn <louis@chmn.me>
1 parent 34c2125 commit 3534056

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

apps/workflowengine/lib/Entity/File.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function getNode(): Node {
136136
if (!$this->event instanceof MapperEvent || $this->event->getObjectType() !== 'files') {
137137
throw new NotFoundException();
138138
}
139-
$nodes = $this->root->getById((int)$this->event->getObjectId());
139+
$nodes = $this->root->getFirstNodeById((int)$this->event->getObjectId());
140140
if (is_array($nodes) && isset($nodes[0])) {
141141
$this->node = $nodes[0];
142142
return $this->node;
@@ -228,11 +228,11 @@ public function importContextIDs(array $contextIDs): void {
228228
$this->eventName = $contextIDs['eventName'];
229229
if ($contextIDs['nodeOwnerId'] !== null) {
230230
$userFolder = $this->root->getUserFolder($contextIDs['nodeOwnerId']);
231-
$nodes = $userFolder->getById($contextIDs['nodeId']);
231+
$node = $userFolder->getFirstNodeById($contextIDs['nodeId']);
232232
} else {
233-
$nodes = $this->root->getById($contextIDs['nodeId']);
233+
$node = $this->root->getFirstNodeById($contextIDs['nodeId']);
234234
}
235-
$this->node = $nodes[0] ?? null;
235+
$this->node = $node;
236236
if ($contextIDs['actingUserId']) {
237237
$this->actingUser = $this->userManager->get($contextIDs['actingUserId']);
238238
}

lib/private/Files/Node/Root.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
388388
}
389389
}
390390
}
391-
$node = current($this->getByIdInPath($id, $path));
391+
$node = $this->getFirstNodeByIdInPath($id, $path);
392392
if (!$node) {
393393
return null;
394394
}

0 commit comments

Comments
 (0)