@@ -48,7 +48,6 @@ public function __construct(
4848 private readonly CollectiveServiceBase $ collectiveService ,
4949 private readonly UserFolderHelper $ userFolderHelper ,
5050 private readonly IUserManager $ userManager ,
51- private readonly IConfig $ config ,
5251 ContainerInterface $ container ,
5352 private readonly SessionService $ sessionService ,
5453 private readonly SluggerInterface $ slugger ,
@@ -144,7 +143,7 @@ public function getFolder(int $collectiveId, int $fileId, string $userId): Folde
144143 */
145144 public function isPageInPageFolder (int $ collectiveId , int $ parentId , int $ pageId , string $ userId ): void {
146145 $ folder = $ this ->getFolder ($ collectiveId , $ parentId , $ userId );
147- if (! isset ( $ folder ->getById ($ pageId )[ 0 ]) ) {
146+ if ($ folder ->getFirstNodeById ($ pageId ) === null ) {
148147 throw new NotFoundException ('Page ' . $ pageId . ' is not a child of ' . $ parentId );
149148 }
150149 }
@@ -636,9 +635,8 @@ public function findByFileId(int $collectiveId, int $fileId, string $userId, ?in
636635 $ collectiveFolder = $ parentId
637636 ? $ this ->getFolder ($ collectiveId , $ parentId , $ userId )
638637 : $ this ->getCollectiveFolder ($ collectiveId , $ userId );
639- $ pageFile = $ collectiveFolder ->getById ($ fileId );
640- if (isset ($ pageFile [0 ]) && $ pageFile [0 ] instanceof File) {
641- $ pageFile = $ pageFile [0 ];
638+ $ pageFile = $ collectiveFolder ->getFirstNodeById ($ fileId );
639+ if ($ pageFile instanceof File) {
642640 return $ this ->findByFile ($ collectiveId , $ pageFile , $ userId );
643641 }
644642 throw new NotFoundException ('Failed to get page by file ID ' . $ fileId . ' in collective ' . $ collectiveId );
0 commit comments