@@ -85,7 +85,6 @@ public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGenerator
85
85
}
86
86
87
87
/**
88
- * {@inheritdoc}
89
88
* The context may contain serialization groups which helps defining joined entities that are readable.
90
89
*/
91
90
public function applyToItem (QueryBuilder $ queryBuilder , QueryNameGeneratorInterface $ queryNameGenerator , string $ resourceClass , array $ identifiers , string $ operationName = null , array $ context = [])
@@ -100,29 +99,17 @@ public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterf
100
99
$ fetchPartial = $ this ->shouldOperationFetchPartial ($ resourceClass , $ options );
101
100
$ contextType = isset ($ context ['api_denormalize ' ]) ? 'denormalization_context ' : 'normalization_context ' ;
102
101
$ serializerContext = $ this ->getSerializerContext ($ context ['resource_class ' ] ?? $ resourceClass , $ contextType , $ options );
103
-
104
- if (isset ($ context [AbstractNormalizer::GROUPS ])) {
105
- $ groups = ['serializer_groups ' => $ context [AbstractNormalizer::GROUPS ]];
106
- } else {
107
- $ groups = $ this ->getSerializerGroups ($ options , $ serializerContext );
108
- }
102
+ $ groups = $ this ->getSerializerGroups ($ options , $ serializerContext );
109
103
110
104
$ this ->joinRelations ($ queryBuilder , $ queryNameGenerator , $ resourceClass , $ forceEager , $ fetchPartial , $ queryBuilder ->getRootAliases ()[0 ], $ groups , $ serializerContext );
111
105
}
112
106
113
107
/**
114
108
* Joins relations to eager load.
115
109
*
116
- * @param QueryBuilder $queryBuilder
117
- * @param QueryNameGeneratorInterface $queryNameGenerator
118
- * @param string $resourceClass
119
- * @param bool $forceEager
120
- * @param string $parentAlias
121
- * @param array $propertyMetadataOptions
122
- * @param array $context
123
- * @param bool $wasLeftJoin if the relation containing the new one had a left join, we have to force the new one to left join too
124
- * @param int $joinCount the number of joins
125
- * @param int $currentDepth the current max depth
110
+ * @param bool $wasLeftJoin if the relation containing the new one had a left join, we have to force the new one to left join too
111
+ * @param int $joinCount the number of joins
112
+ * @param int $currentDepth the current max depth
126
113
*
127
114
* @throws RuntimeException when the max number of joins has been reached
128
115
*/
@@ -241,11 +228,8 @@ private function addSelect(QueryBuilder $queryBuilder, string $entity, string $a
241
228
/**
242
229
* Gets serializer context.
243
230
*
244
- * @param string $resourceClass
245
- * @param string $contextType normalization_context or denormalization_context
246
- * @param array $options represents the operation name so that groups are the one of the specific operation
247
- *
248
- * @return array
231
+ * @param string $contextType normalization_context or denormalization_context
232
+ * @param array $options represents the operation name so that groups are the one of the specific operation
249
233
*/
250
234
private function getSerializerContext (string $ resourceClass , string $ contextType , array $ options ): array
251
235
{
@@ -269,16 +253,13 @@ private function getSerializerContext(string $resourceClass, string $contextType
269
253
$ context = $ resourceMetadata ->getAttribute ($ contextType );
270
254
}
271
255
272
- return $ context ? $ context : [];
256
+ return $ context ?: [];
273
257
}
274
258
275
259
/**
276
260
* Gets serializer groups if available, if not it returns the $options array.
277
261
*
278
262
* @param array $options represents the operation name so that groups are the one of the specific operation
279
- * @param array $context
280
- *
281
- * @return array
282
263
*/
283
264
private function getSerializerGroups (array $ options , array $ context ): array
284
265
{
0 commit comments