Skip to content

Commit

Permalink
Fix attributes resource metadata collection factory
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Oct 20, 2023
1 parent 03dc051 commit ec60035
Showing 1 changed file with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function buildResourceOperations(array $attributes, string $resourceClas
if (is_a($attribute->getName(), AsResource::class, true)) {
/** @var AsResource $resourceAttribute */
$resourceAttribute = $attribute->newInstance();
$resource = $this->convertResourceAttributeToMetadata($resourceAttribute);
$resource = $resourceAttribute->toMetadata();

$resourceAlias = $resource->getAlias();

Expand Down Expand Up @@ -224,26 +224,4 @@ private function buildFormOptions(Operation $operation, MetadataInterface $resou

return $formOptions;
}

private function convertResourceAttributeToMetadata(AsResource $resourceAttribute): ResourceMetadata
{
return new ResourceMetadata(
alias: $resourceAttribute->alias(),
section: $resourceAttribute->section(),
formType: $resourceAttribute->formType(),
templatesDir: $resourceAttribute->templatesDir(),
routePrefix: $resourceAttribute->routePrefix(),
name: $resourceAttribute->name(),
pluralName: $resourceAttribute->pluralName(),
applicationName: $resourceAttribute->applicationName(),
identifier: $resourceAttribute->identifier(),
normalizationContext: $resourceAttribute->normalizationContext(),
denormalizationContext: $resourceAttribute->denormalizationContext(),
validationContext: $resourceAttribute->validationContext(),
class: $resourceAttribute->class(),
driver: $resourceAttribute->driver(),
vars: $resourceAttribute->vars(),
operations: $resourceAttribute->operations(),
);
}
}

0 comments on commit ec60035

Please sign in to comment.