Skip to content

Commit ec6e645

Browse files
authoredOct 9, 2024··
fix(laravel): skip resource path when not available (#6697)
1 parent 1054b9a commit ec6e645

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/Laravel/ApiPlatformProvider.php

+9
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,15 @@ public function register(): void
261261
$refl = new \ReflectionClass(Error::class);
262262
$paths[] = \dirname($refl->getFileName());
263263

264+
$logger = $app->make(LoggerInterface::class);
265+
266+
foreach ($paths as $i => $path) {
267+
if (!file_exists($path)) {
268+
$logger->warning(\sprintf('We skipped reading resources in "%s" as the path does not exist. Please check the configuration at "api-platform.resources".', $path));
269+
unset($paths[$i]);
270+
}
271+
}
272+
264273
return new ConcernsResourceNameCollectionFactory($paths, new AttributesResourceNameCollectionFactory($paths));
265274
});
266275

0 commit comments

Comments
 (0)
Please sign in to comment.