typeResolver = $typeResolver; $this->metadataPool = $metadataPool; $this->hydratorPool = $hydratorPool; $this->readRow = $readRow; } /** * @param object $entity * @param string $identifier * @return object */ public function execute($entity, $identifier) { $entityType = $this->typeResolver->resolve($entity); $hydrator = $this->hydratorPool->getHydrator($entityType); $entityData = $this->readRow->execute($entityType, $identifier); $entity = $hydrator->hydrate($entity, $entityData); return $entity; } }