OpentalentItemDataProvider.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\DataProvider\Common;
  4. use ApiPlatform\Core\DataProvider\DenormalizedIdentifiersAwareItemDataProviderInterface;
  5. use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
  6. /**
  7. * Class OpentalentItemDataProvider : : Décoration du dataProvider item par défaut d'API Platform
  8. * @package App\DataProvider\Common
  9. */
  10. final class OpentalentItemDataProvider implements DenormalizedIdentifiersAwareItemDataProviderInterface, RestrictedDataProviderInterface
  11. {
  12. private DenormalizedIdentifiersAwareItemDataProviderInterface $decorated;
  13. public function __construct(DenormalizedIdentifiersAwareItemDataProviderInterface $decorated)
  14. {
  15. $this->decorated = $decorated;
  16. }
  17. public function supports(string $resourceClass, string $operationName = null, array $context = []): bool
  18. {
  19. return $this->decorated->supports($resourceClass, $operationName, $context);
  20. }
  21. /**
  22. * @inheritDoc
  23. */
  24. public function getItem(string $resourceClass, $id, string $operationName = null, array $context = [])
  25. {
  26. return $this->decorated->getItem($resourceClass, $id, $operationName, $context);
  27. }
  28. }