-
-
Notifications
You must be signed in to change notification settings - Fork 164
[Metadata] Add PHP file resource extractor #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Metadata] Add PHP file resource extractor #1004
Conversation
0316f8a to
306b9b4
Compare
| $property->setValue($resource, $resolvedValue); | ||
| } | ||
|
|
||
| $this->resources = [$resource]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function public function getResources(): array is meant to extract multiple resources by multiple paths, but this line overrides $resources.
Is this planned behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, this is really strange. I need to check that ASAP and on APIP too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AHAH, ok, I remember now, the path is a specific file (not a directory). So we have only one resource metadata per file. That's not the case we some other resource extractor on APIP where we can declare serveral resources in the same file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we configure a directory on the config, but the Symfony Finder will extract files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now if you have multiple file paths, each extract will override previous extract, so even if you have 5 different paths, you only will have single resource as output.
This change will fix that.
$this->resources = [];
foreach ($this->paths as $path) {
--- $this->extractFromPath($path);
}
$this->resources = [];
foreach ($this->paths as $path) {
+++ $this->resources[] = $this->extractFromPath($path);
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix, thx a lot.
src/Component/src/Metadata/Extractor/PhpFileResourceExtractor.php
Outdated
Show resolved
Hide resolved
src/Component/src/Metadata/Extractor/PhpFileResourceExtractor.php
Outdated
Show resolved
Hide resolved
src/Component/src/Metadata/Extractor/AbstractResourceExtractor.php
Outdated
Show resolved
Hide resolved
src/Component/src/Metadata/Extractor/AbstractResourceExtractor.php
Outdated
Show resolved
Hide resolved
src/Component/src/Metadata/Extractor/ResourceExtractorInterface.php
Outdated
Show resolved
Hide resolved
306b9b4 to
b94661e
Compare
b94661e to
bf8ae48
Compare
| /** | ||
| * @inheritdoc | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| * @inheritdoc | |
| */ |
bf84e79 to
910820f
Compare
|
Test with the Skeleton are not working here but works in next PR :( I don't understand why, it works on my local 🥇 |
Same feature as I did on api-platform/core#7017