Skip to content

Commit 93c7816

Browse files
committed
Convert the route prefix attribute name to snake case
1 parent d22857d commit 93c7816

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/Bridge/Symfony/Routing/ApiLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private function addRoute(RouteCollection $routeCollection, string $resourceClas
193193
}
194194
}
195195

196-
$path = trim(trim($resourceMetadata->getAttribute('routePrefix', '')), '/');
196+
$path = trim(trim($resourceMetadata->getAttribute('route_prefix', '')), '/');
197197
$path .= $this->operationPathResolver->resolveOperationPath($resourceShortName, $operation, $operationType, $operationName);
198198

199199
$route = new Route(

tests/Annotation/AnnotatedClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* itemOperations={"foo"={"bar"}},
2424
* collectionOperations={"bar"={"foo"}},
2525
* graphql={"query"={"normalization_context"={"groups"={"foo", "bar"}}}},
26-
* attributes={"foo"="bar", "routePrefix"="/whatever"},
26+
* attributes={"foo"="bar", "route_prefix"="/whatever"},
2727
* )
2828
*
2929
* @author Marcus Speight <[email protected]>

tests/Annotation/ApiResourceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ public function testApiResourceAnnotation()
5151
$this->assertSame('http://example.com/res', $resource->iri);
5252
$this->assertSame(['bar' => ['foo']], $resource->collectionOperations);
5353
$this->assertSame(['query' => ['normalization_context' => ['groups' => ['foo', 'bar']]]], $resource->graphql);
54-
$this->assertSame(['foo' => 'bar', 'routePrefix' => '/whatever'], $resource->attributes);
54+
$this->assertSame(['foo' => 'bar', 'route_prefix' => '/whatever'], $resource->attributes);
5555
}
5656
}

tests/Bridge/Symfony/Routing/ApiLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function testApiLoaderWithPrefix()
106106
'put' => ['method' => 'PUT'],
107107
'delete' => ['method' => 'DELETE'],
108108
]);
109-
$resourceMetadata = $resourceMetadata->withAttributes(['routePrefix' => '/foobar-prefix']);
109+
$resourceMetadata = $resourceMetadata->withAttributes(['route_prefix' => '/foobar-prefix']);
110110

111111
$routeCollection = $this->getApiLoaderWithResourceMetadata($resourceMetadata)->load(null);
112112

tests/Metadata/Resource/Factory/AnnotationResourceMetadataFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testCreate(ProphecyInterface $reader, ProphecyInterface $decorat
4343
$this->assertEquals(['foo' => ['bar' => true]], $metadata->getItemOperations());
4444
$this->assertEquals(['baz' => ['tab' => false]], $metadata->getCollectionOperations());
4545
$this->assertEquals(['sub' => ['bus' => false]], $metadata->getSubresourceOperations());
46-
$this->assertEquals(['a' => 1, 'routePrefix' => '/foobar'], $metadata->getAttributes());
46+
$this->assertEquals(['a' => 1, 'route_prefix' => '/foobar'], $metadata->getAttributes());
4747
$this->assertEquals(['foo' => 'bar'], $metadata->getGraphql());
4848
}
4949

@@ -56,7 +56,7 @@ public function getCreateDependencies()
5656
$annotation->itemOperations = ['foo' => ['bar' => true]];
5757
$annotation->collectionOperations = ['baz' => ['tab' => false]];
5858
$annotation->subresourceOperations = ['sub' => ['bus' => false]];
59-
$annotation->attributes = ['a' => 1, 'routePrefix' => '/foobar'];
59+
$annotation->attributes = ['a' => 1, 'route_prefix' => '/foobar'];
6060
$annotation->graphql = ['foo' => 'bar'];
6161

6262
$reader = $this->prophesize(Reader::class);

0 commit comments

Comments
 (0)