-
-
Notifications
You must be signed in to change notification settings - Fork 914
added a new feature to scan folders where entities are located #3283
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
Conversation
flug
commented
Nov 21, 2019
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tickets | fixes #... |
License | MIT |
Doc PR | api-platform/docs#... |
9c897ae
to
2c04a58
Compare
What is this for? We already support loading from directories, be it XML, YAML or annotations. |
@teohhanhui Basically with this and |
->prototype('scalar')->end() | ||
->end() | ||
->prototype('scalar')->end() | ||
->end() |
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.
Bad indentation.
<services> | ||
<service id="api_platform.metadata.resource.name_collection_factory.directory" decorates="api_platform.metadata.resource.name_collection_factory" | ||
class="ApiPlatform\Core\Metadata\Resource\Factory\DirectoryResourceNameCollectionFactory" public="false"> | ||
<argument>%api_platform.resource_class_directories%</argument> |
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.
<argument>%api_platform.resource_class_directories%</argument> | |
<argument>%api_platform.resource_class_directories%</argument> |
use Doctrine\ORM\Mapping as ORM; | ||
use Psr\Container\ContainerInterface; | ||
|
||
class ClassExtractor extends AbstractExtractor |
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.
final?
|
||
protected function extractPath(string $path) | ||
{ | ||
try { |
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.
?
parent::__construct($paths, $container); | ||
} | ||
|
||
protected function extractPath(string $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.
protected function extractPath(string $path) | |
protected function extractPath(string $path): void |
return; | ||
} | ||
/** | ||
* @var string |
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.
To remove.
955badc
to
457ca33
Compare
*/ | ||
private function update(ResourceMetadata $resourceMetadata, array $metadata): ResourceMetadata | ||
{ | ||
foreach (['shortName'] as $property) { |
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.
do we really need this if there's one property? Let's simplify the code.
c82f0ff
to
932e93b
Compare
} | ||
$resource['shortName'] = (new \ReflectionClass($resourceClass))->getShortName(); | ||
|
||
return $this->update($parentResourceMetadata ?: new ResourceMetadata(), $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.
$resourceMetadata = $parentResourceMetadata ?: new ResourceMetadata();
if (null !== $resourceMetadata->getShortname()) {
return $resourceMetadata;
}
return $resourceMetadata->withShortname((new \ReflectionClass($resourceClass))->getShortName());
update
method isn't required, as isn't the array
932e93b
to
71366ef
Compare
71366ef
to
00bcfed
Compare
@@ -14,6 +14,7 @@ | |||
<service id="ApiPlatform\Core\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface" alias="api_platform.metadata.resource.name_collection_factory" /> | |||
|
|||
<!-- Resource metadata --> | |||
|
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.
empty line can be removed
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.
Code looks good to me, we just need to validate the new configuration name (auto_mapping
), ping @dunglas
00bcfed
to
8ad7f4b
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |