Skip to content

Commit 14756cb

Browse files
authored
Merge pull request #2095 from soyuka/fix-subresource_context
fix #2094 by improving error message
2 parents 4321e64 + 9c3e083 commit 14756cb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/DataProvider/OperationDataProviderTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ private function extractIdentifiers(array $parameters, array $attributes)
9999
return $id;
100100
}
101101

102+
if (!isset($attributes['subresource_context'])) {
103+
throw new RuntimeException('Either "item_operation_name" or "collection_operation_name" must be defined, unless the "_api_receive" request attribute is set to false.');
104+
}
105+
102106
$identifiers = [];
103107

104108
foreach ($attributes['subresource_context']['identifiers'] as $key => list($id, $resourceClass, $hasIdentifier)) {

0 commit comments

Comments
 (0)