OpentalentDataPersister.php 969 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\DataPersister\Common;
  4. use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
  5. /**
  6. * Class OpentalentDataPersister : Décoration du dataPersister par défaut d'API Platform
  7. * @package App\DataPersister\Common
  8. */
  9. final class OpentalentDataPersister implements ContextAwareDataPersisterInterface
  10. {
  11. private ContextAwareDataPersisterInterface $decorated;
  12. public function __construct(ContextAwareDataPersisterInterface $decorated)
  13. {
  14. $this->decorated = $decorated;
  15. }
  16. public function supports($data, array $context = []): bool
  17. {
  18. return $this->decorated->supports($data, $context);
  19. }
  20. public function persist($data, array $context = [])
  21. {
  22. $result = $this->decorated->persist($data, $context);
  23. return $result;
  24. }
  25. public function remove($data, array $context = [])
  26. {
  27. return $this->decorated->remove($data, $context);
  28. }
  29. }