Skip to content

Commit

Permalink
fix(doctrine): fix case on Mercure ExpressionLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Mar 8, 2024
1 parent dad8b7d commit 9b7c79a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Expand Up @@ -85,7 +85,7 @@ public function __construct(LegacyResourceClassResolverInterface|ResourceClassRe
$this->expressionLanguage->addFunction($rawurlencode);

$this->expressionLanguage->addFunction(
new ExpressionFunction('getOperation', static fn (string $apiResource, string $name): string => sprintf('getOperation(%s, %s)', $apiResource, $name), static fn (array $arguments, $apiResource, string $name): Operation => $resourceMetadataFactory->create($resourceClassResolver->getResourceClass($apiResource))->getOperation($name))
new ExpressionFunction('get_operation', static fn (string $apiResource, string $name): string => sprintf('getOperation(%s, %s)', $apiResource, $name), static fn (array $arguments, $apiResource, string $name): Operation => $resourceMetadataFactory->create($resourceClassResolver->getResourceClass($apiResource))->getOperation($name))
);
$this->expressionLanguage->addFunction(
new ExpressionFunction('iri', static fn (string $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL, ?string $operation = null): string => sprintf('iri(%s, %d, %s)', $apiResource, $referenceType, $operation), static fn (array $arguments, $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL, $operation = null): string => $iriConverter->getIriFromResource($apiResource, $referenceType, $operation))
Expand Down
Expand Up @@ -177,7 +177,7 @@ public function testPublishUpdateMultipleTopicsUsingExpressionLanguage(): void
'topics' => [
'@=iri(object)',
'@=iri(object, '.UrlGeneratorInterface::ABS_PATH.')',
'@=iri(object, '.UrlGeneratorInterface::ABS_URL.', getOperation(object, "/custom_resource/mercure_with_topics_and_get_operations/{id}{._format}"))',
'@=iri(object, '.UrlGeneratorInterface::ABS_URL.', get_operation(object, "/custom_resource/mercure_with_topics_and_get_operations/{id}{._format}"))',
],
];

Expand Down
Expand Up @@ -28,7 +28,7 @@
mercure: [
'topics' => [
'@=iri(object)',
'@=iri(object, '.UrlGeneratorInterface::ABS_URL.', getOperation(object, "/custom_resource/mercure_with_topics_and_get_operations/{id}{._format}"))',
'@=iri(object, '.UrlGeneratorInterface::ABS_URL.', get_operation(object, "/custom_resource/mercure_with_topics_and_get_operations/{id}{._format}"))',
],
]
)]
Expand Down
Expand Up @@ -28,7 +28,7 @@
mercure: [
'topics' => [
'@=iri(object)',
'@=iri(object, '.UrlGeneratorInterface::ABS_URL.', getOperation(object, "/custom_resource/mercure_with_topics_and_get_operations/{id}{._format}"))',
'@=iri(object, '.UrlGeneratorInterface::ABS_URL.', get_operation(object, "/custom_resource/mercure_with_topics_and_get_operations/{id}{._format}"))',
],
]
)]
Expand Down

0 comments on commit 9b7c79a

Please sign in to comment.