[Metadata] Add PHP file resource extractor#1004
[Metadata] Add PHP file resource extractor#1004loic425 merged 4 commits intoSylius:external-routing-filesfrom
Conversation
0316f8a to
306b9b4
Compare
| $property->setValue($resource, $resolvedValue); | ||
| } | ||
|
|
||
| $this->resources = [$resource]; |
There was a problem hiding this comment.
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.
you are right, this is really strange. I need to check that ASAP and on APIP too.
There was a problem hiding this comment.
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.
we configure a directory on the config, but the Symfony Finder will extract files.
There was a problem hiding this comment.
There was a problem hiding this comment.
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);
}
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.
| /** | |
| * @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