Skip to content

Commit 53944fb

Browse files
authored
Style fixes in EagerLoadingExtension (#1545)
1 parent a388580 commit 53944fb

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

src/Bridge/Doctrine/Orm/Extension/EagerLoadingExtension.php

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGenerator
8585
}
8686

8787
/**
88-
* {@inheritdoc}
8988
* The context may contain serialization groups which helps defining joined entities that are readable.
9089
*/
9190
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
10099
$fetchPartial = $this->shouldOperationFetchPartial($resourceClass, $options);
101100
$contextType = isset($context['api_denormalize']) ? 'denormalization_context' : 'normalization_context';
102101
$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);
109103

110104
$this->joinRelations($queryBuilder, $queryNameGenerator, $resourceClass, $forceEager, $fetchPartial, $queryBuilder->getRootAliases()[0], $groups, $serializerContext);
111105
}
112106

113107
/**
114108
* Joins relations to eager load.
115109
*
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
126113
*
127114
* @throws RuntimeException when the max number of joins has been reached
128115
*/
@@ -241,11 +228,8 @@ private function addSelect(QueryBuilder $queryBuilder, string $entity, string $a
241228
/**
242229
* Gets serializer context.
243230
*
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
249233
*/
250234
private function getSerializerContext(string $resourceClass, string $contextType, array $options): array
251235
{
@@ -269,16 +253,13 @@ private function getSerializerContext(string $resourceClass, string $contextType
269253
$context = $resourceMetadata->getAttribute($contextType);
270254
}
271255

272-
return $context ? $context : [];
256+
return $context ?: [];
273257
}
274258

275259
/**
276260
* Gets serializer groups if available, if not it returns the $options array.
277261
*
278262
* @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
282263
*/
283264
private function getSerializerGroups(array $options, array $context): array
284265
{

0 commit comments

Comments
 (0)