Skip to content

Commit

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


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

Check warning on line 265 in src/Laravel/ApiPlatformProvider.php

View check run for this annotation

Codecov / codecov/patch

src/Laravel/ApiPlatformProvider.php#L265

Added line #L265 was not covered by tests

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]);

Check warning on line 270 in src/Laravel/ApiPlatformProvider.php

View check run for this annotation

Codecov / codecov/patch

src/Laravel/ApiPlatformProvider.php#L267-L270

Added lines #L267 - L270 were not covered by tests
}
}

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

Expand Down

0 comments on commit 57f085f

Please sign in to comment.