Skip to content

Commit b5e86f2

Browse files
committed
Avoid type error when output_class is false
1 parent 10303dc commit b5e86f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DataProvider/OperationDataProviderTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ trait OperationDataProviderTrait
4949
*/
5050
private function getCollectionData(array $attributes, array $context)
5151
{
52-
return $this->collectionDataProvider->getCollection($attributes['output_class'], $attributes['collection_operation_name'], $context);
52+
return $this->collectionDataProvider->getCollection($attributes['output_class'] ?: $attributes['resource_class'], $attributes['collection_operation_name'], $context);
5353
}
5454

5555
/**
@@ -59,7 +59,7 @@ private function getCollectionData(array $attributes, array $context)
5959
*/
6060
private function getItemData($identifiers, array $attributes, array $context)
6161
{
62-
return $this->itemDataProvider->getItem($attributes['output_class'], $identifiers, $attributes['item_operation_name'], $context);
62+
return $this->itemDataProvider->getItem($attributes['output_class'] ?: $attributes['resource_class'], $identifiers, $attributes['item_operation_name'], $context);
6363
}
6464

6565
/**
@@ -75,7 +75,7 @@ private function getSubresourceData($identifiers, array $attributes, array $cont
7575
throw new RuntimeException('Subresources not supported');
7676
}
7777

78-
return $this->subresourceDataProvider->getSubresource($attributes['output_class'], $identifiers, $attributes['subresource_context'] + $context, $attributes['subresource_operation_name']);
78+
return $this->subresourceDataProvider->getSubresource($attributes['output_class'] ?: $attributes['resource_class'], $identifiers, $attributes['subresource_context'] + $context, $attributes['subresource_operation_name']);
7979
}
8080

8181
/**
@@ -93,7 +93,7 @@ private function extractIdentifiers(array $parameters, array $attributes)
9393
$id = $parameters['id'];
9494

9595
if (null !== $this->identifierConverter) {
96-
return $this->identifierConverter->convert((string) $id, $attributes['output_class']);
96+
return $this->identifierConverter->convert((string) $id, $attributes['output_class'] ?: $attributes['resource_class']);
9797
}
9898

9999
return $id;

0 commit comments

Comments
 (0)