Skip to content

Commit b4bb68e

Browse files
committed
remove deprec
1 parent c6540d9 commit b4bb68e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ private function getOperationWithDefaults(ApiResource $resource, Operation $oper
185185
continue;
186186
}
187187

188-
// TODO: remove in 3.0
189-
if ($operation instanceof HttpOperation && 'getUriVariables' === $methodName && !$operation->getUriTemplate() && $operation instanceof CollectionOperationInterface && !$operation->getUriVariables()) {
190-
trigger_deprecation('api-platform', '2.7', sprintf('Identifiers on "%s" are declared on the default #[ApiResource] but you did not specify identifiers on the collection operation. In 3.0 the collection operations can have identifiers, you should specify identifiers on the operation not on the resource to avoid unwanted behavior.', $operation->getShortName()));
191-
continue;
192-
}
193-
194188
$operation = $operation->{'with'.substr($methodName, 3)}($value);
195189
}
196190

src/Metadata/Resource/Factory/UriTemplateResourceMetadataCollectionFactory.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ private function generateUriTemplate(HttpOperation $operation): string
101101
$uriTemplate = sprintf('/%s', $this->pathSegmentNameGenerator->getSegmentName($operation->getShortName()));
102102
$uriVariables = $operation->getUriVariables() ?? [];
103103

104+
if (!\is_array($uriVariables)) {
105+
dd($operation);
106+
}
107+
104108
if ($parameters = array_keys($uriVariables)) {
105109
if (($operation->getExtraProperties()['is_legacy_resource_metadata'] ?? false) && 1 < \count($uriVariables[$parameters[0]]->getIdentifiers() ?? [])) {
106110
$parameters[0] = 'id';
@@ -126,7 +130,11 @@ private function configureUriVariables($operation)
126130
[] === $operation->getUriVariables() ||
127131
($operation instanceof CollectionOperationInterface && null === $operation->getUriTemplate())
128132
)) {
129-
return $operation;
133+
if (null === $operation->getUriVariables()) {
134+
return $operation;
135+
}
136+
137+
return $this->normalizeUriVariables($operation);
130138
}
131139

132140
if (!$operation->getUriVariables()) {
@@ -178,6 +186,7 @@ private function configureUriVariables($operation)
178186
private function normalizeUriVariables($operation)
179187
{
180188
$uriVariables = (array) ($operation->getUriVariables() ?? []);
189+
181190
$normalizedUriVariables = [];
182191
$resourceClass = $operation->getClass();
183192

0 commit comments

Comments
 (0)