-
-
Notifications
You must be signed in to change notification settings - Fork 159
Use plural name from new resource metadata #999
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
base: 1.13
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,12 @@ private function getResourceWithDefaults(string $resourceClass, ResourceMetadata | |
$resource = $resource->withName($resourceConfiguration->getName()); | ||
} | ||
|
||
if (null === $resource->getPluralName()) { | ||
$resourcePluralName = $resourceConfiguration->getPluralName(); | ||
|
||
$resource = $resource->withPluralName($resourcePluralName); | ||
} | ||
|
||
return $resource; | ||
} | ||
|
||
|
@@ -143,20 +149,6 @@ private function getOperationWithDefaults(ResourceMetadata $resource, Operation | |
|
||
$operation = $operation->withResource($resource); | ||
|
||
if (null === $resource->getName()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A question about line of code above this code. $resourceConfiguration = $this->resourceRegistry->get($resource->getAlias() ?? ''); We probably should assert it as |
||
$resourceName = $resourceConfiguration->getName(); | ||
|
||
$resource = $resource->withName($resourceName); | ||
$operation = $operation->withResource($resource); | ||
} | ||
|
||
if (null === $resource->getPluralName()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess plural name is set somehow else, so this code is removed, but I don't fully understand how or where. |
||
$resourcePluralName = $resourceConfiguration->getPluralName(); | ||
|
||
$resource = $resource->withPluralName($resourcePluralName); | ||
$operation = $operation->withResource($resource); | ||
} | ||
|
||
if (null === $operation->getNormalizationContext()) { | ||
$operation = $operation->withNormalizationContext($resource->getNormalizationContext()); | ||
} | ||
|
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.
Can be optimized a little.