/** * Retrieve a hydrator for a given entity * * If the entity has a mapped hydrator, returns that hydrator. If not, and * a default hydrator is present, the default hydrator is returned. * Otherwise, a boolean false is returned. * * @param object $entity * @return ExtractionInterface|false */ public function getHydratorForEntity($entity) { $class = get_class($entity); $classLower = strtolower($class); if (isset($this->hydratorMap[$classLower])) { return $this->hydratorMap[$classLower]; } if ($this->metadataMap->has($entity)) { $metadata = $this->metadataMap->get($class); $hydrator = $metadata->getHydrator(); if ($hydrator instanceof ExtractionInterface) { $this->addHydrator($class, $hydrator); return $hydrator; } } if ($this->defaultHydrator instanceof ExtractionInterface) { return $this->defaultHydrator; } return false; }