vendor/shopware/core/Profiling/Entity/EntityReaderProfiler.php line 34

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Profiling\Entity;
  3. use Shopware\Core\Framework\Context;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
  5. use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Read\EntityReaderInterface;
  7. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  8. use Symfony\Component\Stopwatch\Stopwatch;
  9. class EntityReaderProfiler implements EntityReaderInterface
  10. {
  11.     /**
  12.      * @var EntityReaderInterface
  13.      */
  14.     private $decorated;
  15.     /**
  16.      * @var Stopwatch
  17.      */
  18.     private $stopwatch;
  19.     public function __construct(EntityReaderInterface $decoratedStopwatch $stopwatch)
  20.     {
  21.         $this->decorated $decorated;
  22.         $this->stopwatch $stopwatch;
  23.     }
  24.     public function read(EntityDefinition $definitionCriteria $criteriaContext $context): EntityCollection
  25.     {
  26.         $this->stopwatch->start('read.' $definition->getEntityName());
  27.         $data $this->decorated->read($definition$criteria$context);
  28.         $this->stopwatch->stop('read.' $definition->getEntityName());
  29.         return $data;
  30.     }
  31. }