Skip to content

Commit 315241f

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

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

apps/workflowengine/lib/Entity/File.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ 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());
140-
if (is_array($nodes) && isset($nodes[0])) {
141-
$this->node = $nodes[0];
139+
$this->node = $this->root->getFirstNodeById((int)$this->event->getObjectId());
140+
if ($this->node !== null) {
142141
return $this->node;
143142
}
144143
break;
@@ -228,11 +227,11 @@ public function importContextIDs(array $contextIDs): void {
228227
$this->eventName = $contextIDs['eventName'];
229228
if ($contextIDs['nodeOwnerId'] !== null) {
230229
$userFolder = $this->root->getUserFolder($contextIDs['nodeOwnerId']);
231-
$nodes = $userFolder->getById($contextIDs['nodeId']);
230+
$node = $userFolder->getFirstNodeById($contextIDs['nodeId']);
232231
} else {
233-
$nodes = $this->root->getById($contextIDs['nodeId']);
232+
$node = $this->root->getFirstNodeById($contextIDs['nodeId']);
234233
}
235-
$this->node = $nodes[0] ?? null;
234+
$this->node = $node;
236235
if ($contextIDs['actingUserId']) {
237236
$this->actingUser = $this->userManager->get($contextIDs['actingUserId']);
238237
}

0 commit comments

Comments
 (0)