typeResolver = $typeResolver; $this->hydratorPool = $hydratorPool; $this->updateRow = $updateRow; } /** * @param object $entity * @param array $arguments * @return object */ public function execute($entity, $arguments = []) { $entityType = $this->typeResolver->resolve($entity); $hydrator = $this->hydratorPool->getHydrator($entityType); $arguments = array_merge($hydrator->extract($entity), $arguments); $entityData = $this->updateRow->execute($entityType, $arguments); $entity = $hydrator->hydrate($entity, $entityData); return $entity; } }