Skip to content

Commit d5dc43f

Browse files
committed
MongoDb: as its experimental do not invalid constructor args
1 parent d77d61c commit d5dc43f

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

src/Bridge/Doctrine/MongoDbOdm/Filter/SearchFilter.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,10 @@ final class SearchFilter extends AbstractFilter implements SearchFilterInterface
4242

4343
public const DOCTRINE_INTEGER_TYPE = MongoDbType::INTEGER;
4444

45-
public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface $iriConverter, PropertyAccessorInterface $propertyAccessor = null, LoggerInterface $logger = null, array $properties = null, IdentifiersExtractorInterface $identifiersExtractor = null)
45+
public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface $iriConverter, IdentifiersExtractorInterface $identifiersExtractor, PropertyAccessorInterface $propertyAccessor = null, LoggerInterface $logger = null, array $properties = null)
4646
{
4747
parent::__construct($managerRegistry, $logger, $properties);
4848

49-
if (null === $identifiersExtractor) {
50-
@trigger_error('Not injecting ItemIdentifiersExtractor is deprecated since API Platform 2.5 and can lead to unexpected behaviors, it will not be possible anymore in API Platform 3.0.', E_USER_DEPRECATED);
51-
}
52-
5349
$this->iriConverter = $iriConverter;
5450
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
5551
$this->identifiersExtractor = $identifiersExtractor;

src/Bridge/Doctrine/Orm/Filter/SearchFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function __construct(ManagerRegistry $managerRegistry, ?RequestStack $req
4949
}
5050

5151
$this->iriConverter = $iriConverter;
52-
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
5352
$this->identifiersExtractor = $identifiersExtractor;
53+
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
5454
}
5555

5656
protected function getIriConverter(): IriConverterInterface

src/Bridge/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
<service id="api_platform.doctrine_mongodb.odm.search_filter" class="ApiPlatform\Core\Bridge\Doctrine\MongoDbOdm\Filter\SearchFilter" public="false" abstract="true">
6565
<argument type="service" id="doctrine_mongodb" />
6666
<argument type="service" id="api_platform.iri_converter" />
67+
<argument type="service" id="api_platform.identifiers_extractor.cached" />
6768
<argument type="service" id="api_platform.property_accessor" />
6869
<argument type="service" id="logger" on-invalid="ignore" />
69-
<argument key="$identifiersExtractor" type="service" id="api_platform.identifiers_extractor.cached" on-invalid="ignore" />
7070
</service>
7171

7272
<service id="ApiPlatform\Core\Bridge\Doctrine\MongoDbOdm\Filter\SearchFilter" alias="api_platform.doctrine_mongodb.odm.search_filter" />

src/GraphQl/Serializer/ObjectNormalizer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use ApiPlatform\Core\Api\IdentifiersExtractorInterface;
1717
use ApiPlatform\Core\Api\IriConverterInterface;
18+
use ApiPlatform\Core\Util\ClassInfoTrait;
1819
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
1920
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
2021
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -25,6 +26,8 @@
2526
*/
2627
final class ObjectNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
2728
{
29+
use ClassInfoTrait;
30+
2831
public const FORMAT = 'graphql';
2932
public const ITEM_RESOURCE_CLASS_KEY = '#itemResourceClass';
3033
public const ITEM_IDENTIFIERS_KEY = '#itemIdentifiers';

tests/Bridge/Doctrine/MongoDbOdm/Filter/SearchFilterTest.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -551,19 +551,6 @@ public function provideApplyTestData(): array
551551
);
552552
}
553553

554-
/**
555-
* @group legacy
556-
* @expectedDeprecation Not injecting ItemIdentifiersExtractor is deprecated since API Platform 2.5 and can lead to unexpected behaviors, it will not be possible anymore in API Platform 3.0.
557-
*/
558-
public function testNotPassingIdentifiersExtractor()
559-
{
560-
$iriConverterProphecy = $this->prophesize(IriConverterInterface::class);
561-
$iriConverter = $iriConverterProphecy->reveal();
562-
$propertyAccessor = self::$kernel->getContainer()->get('test.property_accessor');
563-
564-
return new SearchFilter($this->managerRegistry, $iriConverter, $propertyAccessor, null, null, null);
565-
}
566-
567554
protected function buildSearchFilter(ManagerRegistry $managerRegistry, ?array $properties = null)
568555
{
569556
$relatedDummyProphecy = $this->prophesize(RelatedDummy::class);
@@ -585,6 +572,6 @@ protected function buildSearchFilter(ManagerRegistry $managerRegistry, ?array $p
585572
$identifierExtractorProphecy = $this->prophesize(IdentifiersExtractorInterface::class);
586573
$identifierExtractorProphecy->getIdentifiersFromResourceClass(Argument::type('string'))->willReturn(['id']);
587574

588-
return new SearchFilter($managerRegistry, $iriConverter, $propertyAccessor, null, $properties, $identifierExtractorProphecy->reveal());
575+
return new SearchFilter($managerRegistry, $iriConverter, $identifierExtractorProphecy->reveal(), $propertyAccessor, null, $properties);
589576
}
590577
}

0 commit comments

Comments
 (0)