objectManager = $objectManager; $this->hydrators = $hydrators; } /** * @param string $entityType * @return HydratorInterface */ public function getHydrator($entityType) { if (isset($this->hydrators[$entityType])) { return $this->objectManager->get($this->hydrators[$entityType]); } else { return $this->objectManager->get(HydratorInterface::class); } } }