Skip to content

Commit

Permalink
fix(laravel): skip resource path when not available (#6697)
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka authored Oct 9, 2024
1 parent 1054b9a commit ec6e645
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Laravel/ApiPlatformProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ public function register(): void
$refl = new \ReflectionClass(Error::class);
$paths[] = \dirname($refl->getFileName());

$logger = $app->make(LoggerInterface::class);

foreach ($paths as $i => $path) {
if (!file_exists($path)) {
$logger->warning(\sprintf('We skipped reading resources in "%s" as the path does not exist. Please check the configuration at "api-platform.resources".', $path));
unset($paths[$i]);
}
}

return new ConcernsResourceNameCollectionFactory($paths, new AttributesResourceNameCollectionFactory($paths));
});

Expand Down

0 comments on commit ec6e645

Please sign in to comment.