code: public function setHydrator($hydrator)
      {
          if (!is_string($hydrator) && !$hydrator instanceof HydratorInterface) {
              throw new Exception\InvalidArgumentException(
                  sprintf(
                      '%s expects parameter 1 to be an object of instance Zend\Stdlib\Hydrator\HydratorInterface or string, %s provided instead',
                      __METHOD__,
                      is_object($hydrator) ? get_class($hydrator) : gettype($hydrator)
                  )
              );
          }
          $this->hydrator = $hydrator;
  
          return $this;
      }
docs: Sets hydrator of namespace entity for converting array to namespace entity
  
  @param  HydratorInterface|string $hydrator
  @return self