Skip to content

Commit 20bd583

Browse files
committed
Merge branch '2.0'
2 parents f720afb + f69d00c commit 20bd583

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ final class EagerLoadingExtension implements QueryCollectionExtensionInterface,
4040

4141
private $propertyNameCollectionFactory;
4242
private $propertyMetadataFactory;
43-
private $resourceMetadataFactory;
4443
private $maxJoins;
45-
private $forceEager;
4644
private $serializerContextBuilder;
4745
private $requestStack;
4846

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ final class FilterEagerLoadingExtension implements QueryCollectionExtensionInter
2727
{
2828
use ShouldEagerLoad;
2929

30-
private $resourceMetadataFactory;
31-
private $forceEager;
32-
3330
public function __construct(ResourceMetadataFactoryInterface $resourceMetadataFactory, $forceEager = true)
3431
{
3532
$this->resourceMetadataFactory = $resourceMetadataFactory;

src/Bridge/Doctrine/Orm/Util/ShouldEagerLoad.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818

1919
/**
2020
* @author Antoine Bluchet <[email protected]>
21+
*
22+
* @internal
2123
*/
2224
trait ShouldEagerLoad
2325
{
26+
private $forceEager;
27+
private $resourceMetadataFactory;
28+
2429
/**
2530
* Checks if an operation has a `force_eager` attribute.
2631
*
@@ -50,8 +55,10 @@ private function shouldOperationForceEager(string $resourceClass, array $options
5055
* @param EntityManager $em
5156
* @param ClassMetadataInfo $classMetadata
5257
* @param array $checked array cache of tested metadata classes
58+
*
59+
* @return bool
5360
*/
54-
private function hasFetchEagerAssociation(EntityManager $em, ClassMetadataInfo $classMetadata, &$checked = [])
61+
private function hasFetchEagerAssociation(EntityManager $em, ClassMetadataInfo $classMetadata, array &$checked = []): bool
5562
{
5663
$checked[] = $classMetadata->name;
5764

src/Hal/Serializer/ItemNormalizer.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function getAttributes($object, $format, array $context)
9595
*/
9696
private function getComponents($object, string $format = null, array $context)
9797
{
98-
if (isset($this->componentsCache[$context['cache_key']])) {
98+
if (false !== $context['cache_key'] && isset($this->componentsCache[$context['cache_key']])) {
9999
return $this->componentsCache[$context['cache_key']];
100100
}
101101

@@ -137,7 +137,11 @@ private function getComponents($object, string $format = null, array $context)
137137
$components['links'][] = $relation;
138138
}
139139

140-
return $this->componentsCache[$context['cache_key']] = $components;
140+
if (false !== $context['cache_key']) {
141+
$this->componentsCache[$context['cache_key']] = $components;
142+
}
143+
144+
return $components;
141145
}
142146

143147
/**

0 commit comments

Comments
 (0)