Returns a GeneratedHydrator for the object

@param object $object

@return HydratorInterface
421653
private static function getHydrator($object)
    {
        $class = get_class($object);

        if (!isset(self::$hydratorCache[$class])) {
            $configuration = new Configuration($class);
            $hydratorClass = $configuration->createFactory()->getHydratorClass();

            self::$hydratorCache[$class] = new $hydratorClass;
        }

        return self::$hydratorCache[$class];
    }
975855
protected function hydrateObjectForm($object)
    {
        $data = array(
            "id" => $object->getId(),
            "title" => $object->getTitle(),
            "address1" => $object->getAddress1(),
            "address2" => $object->getAddress2(),
            "address3" => $object->getAddress3(),
            "zipcode" => $object->getZipcode(),
            "city" => $object->getCity(),
            "country_id" => $object->getCountryId(),
            "description" => $object->getDescription(),
            "latitude" => $object->getLatitude(),
            "longitude" => $object->getLongitude(),
        );

        return $this->getUpdateForm($data);
    }
1222373
public function hydrate(array $data, $object)
    {
        if (isset($data['timestamp'])) {
            $object->setCreatedAt(new \DateTime($data['timestamp']));
        }
        if (isset($data['resource-title'])) {
            $object->setTitle($data['resource-title']);
        }
        if (isset($data['resource-type'])) {
            $object->setType($data['resource-type']);
        }
        if (isset($data['message'])) {
            $object->setMessage($data['message']);
        }
        if (isset($data['containing-class'])) {
            $object->setClassName($data['containing-class']);
        }
        if (isset($data['certname'])) {
            $object->setNodeName($data['certname']);
        }
        if (isset($data['status'])) {
            $object->setStatus($data['status']);
        }
        return $object;
    }
519478
public function getObjectValidator($object)
    {
        $class = get_class($object);
        if (!isset($this->validators[ $class ])) {
            $this->validators[ $class ] = $this->reader->getObjectValidator($object);
        }

        return $this->validators[ $class ];
    }
804263
public function hydrate(array $data, $object)
    {
        if (!$object instanceof PageInfo) {
            throw new \Exception('$object must be an instance of PageInfo');
        }

        return parent::hydrate($data, $object);
    }
174152
public function hydrate(array $data, $object)
    {
        foreach ($data as $name => $value) {
            $property = StringUtil::camel($name);
            if (property_exists($object, $property)) {
                $object->{$property} = $value;
            }
        }

        return $object;
    }
1195533
public function hydrate(array $data, $object)
    {
        $array = [];
        $hydrator = new AnnotationHydrator();

        foreach ($data as $value) {
            $clonedObject = clone $object;
            $array[] = $hydrator->hydrate($value, $clonedObject);
        }

        return $array;
    }
95348
public function hydrate(array $data, $object)
    {
        if (!$object instanceof TicketCategory) {
            throw new \InvalidArgumentException('$object must be an instance of TicketCategory');
        }

        return parent::hydrate($data, $object);
    }
532244
public function unhydrate($object)
    {
        $properties = $this->classMetadata->getPropertiesInfos();
        $datas = [];

        if (!is_object($object)) {
            return $object;
        }

        foreach ($properties as $name => $infos) {
            $prop = new \ReflectionProperty($this->classMetadata->getName(), $name);
            $prop->setAccessible(true);

            $value = $prop->getValue($object);
            if (null === $value) {
                continue;
            }

            if (($value instanceof \MongoDB\Model\BSONDocument) || ($value instanceof \MongoDB\Model\BSONArray)) {
                $value = $this->recursiveConvertInArray((array) $value);
            }

            if (is_object($value) && $infos->getEmbedded()) {
                $class = get_class($value);
                if (!class_exists($class)) {
                    $class = $this->classMetadata->getNamespace() . "\\" . $class;
                }
                $value = $this->getHydrator($class)->unhydrate($value);
            }

            if (is_array($value) && $infos->getMultiEmbedded()) {
                $array = [];
                foreach ($value as $key => $embeddedValue) {
                    $class = $infos->getEmbeddedClass();
                    if (is_object($embeddedValue) && false !== ($realClass = get_class($embeddedValue))) {
                        $class = $realClass;
                    }
                    if (!class_exists($class)) {
                        $class = $this->classMetadata->getNamespace() . "\\" . $class;
                    }
                    $array[$key] = $this->getHydrator($class)->unhydrate($embeddedValue);
                }
                $value = $array;
            }

            if (is_object($value) && null != ($refInfos = $infos->getReferenceInfo()) && !$refInfos->getIsMultiple() && !$value instanceof \MongoDB\BSON\ObjectId) {
                $class = $refInfos->getDocument();
                if (!class_exists($class)) {
                    $class = $this->classMetadata->getNamespace() . "\\" . $class;
                }

                $value = $this->getHydrator($class)->unhydrate($value)["_id"];
            }

            if (is_array($value) && null != ($refInfos = $infos->getReferenceInfo()) && $refInfos->getIsMultiple()) {
                $array = [];
                foreach ($value as $referedValue) {
                    $class = $refInfos->getDocument();
                    if (!class_exists($class)) {
                        $class = $this->classMetadata->getNamespace() . "\\" . $class;
                    }
                    if (!$value instanceof \MongoDB\BSON\ObjectId) {
                        $array[] = $this->getHydrator($class)->unhydrate($referedValue)["_id"];
                    } else {
                        $array[] = $value;
                    }
                }
                $value = $array;
            }

            if ($value instanceof \DateTime) {
                $value = new \MongoDB\BSON\UTCDateTime($value->getTimestamp() * 1000);
            }

            $datas[$infos->getField()] = $value;
        }

        return $datas;
    }
1301738
public static function get($object) {
        $class = $object->name;

        /** @var \Gcs\Framework\Core\Orm\Entity\Entity $class */
        $class = new $class();

        $request = Request::instance();

        if (($class->getForm() == '' && $request->data->form == true) || isset($request->data->post[$class->getForm()])) {
            switch ($request->data->method) {
                case 'get' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeInsert();
                    break;

                case 'post' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeInsert();
                    break;

                case 'put' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeUpdate();
                    break;

                case 'patch' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforePatch();
                    break;

                case 'delete' :
                    $class->hydrate(strtolower($class->name()) . '_');
                    $class->beforeDelete();
                    break;
            }

            $class->check();
        }

        return $class;
    }
989946
public function getHydrator($class)
    {
        $metadata = $this->classMetadataFactory->getMetadataForClass($class);
        return new Hydrator($this->classMetadataFactory, $metadata, $this->documentManager, $this->repositoryFactory);
    }
877810
public function hydrate(array $data, $object)
    {
        $object->setType($data['type'])
            ->setData($data['data'])
            ->setStore($data['store'])
            ->setDownload($data['download'])
            ->setOutputFilename($data['output_filename'])
            ->setCategory($data['category']);

        return $object;
    }
961077
public function hydrate(array $data, $object)
    {
        $object->setId($this->getData('id', $data));
        $object->setName($this->getData('name', $data));
        return $object;
    }
813327
private function getHydrator($class): \Closure
    {
        if (isset($this->hydrators[$class])) {
            return $this->hydrators[$class];
        }

        return $this->hydrators[$class] = \Closure::bind(function ($object, array $properties) {
            foreach ($properties as $property => $value) {
                $object->$property = $value;
            }
        }, \null, $class);
    }
240817
private function getPayload($object)
    {
        $fqcn = get_class($object);

        foreach ($this->customSerializers as $customSerializer) {
            if ($customSerializer->canHandle($fqcn)) {
                return $customSerializer->serialize($object);
            }
        }

        return $this->hydratorFactory->getHydrator($fqcn)->extract($object);
    }
621759
public function hydrate(array $data, $object)
    {
        if (!isset($data['owner'])) {
            return $object;
        }

        $hydrators = new AggregateHydrator();
        $hydrators->add(new UserHydrator());
        $hydrators->add(new ImageCollectionAwareHydrator());

        $object->setOwner($hydrators->hydrate($data['owner'], new User()));

        return $object;
    }
369145
public function hydrate($object, $data, $prefix)
    {
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                // Check setMethod
     //           print_r(strrpos($key, $prefix));
                if (strrpos($key, $prefix) !== false && !$this->callSetter($object, $this->format($key, $prefix), $value)) {
                    // If no setter is defined, we reinject into array
                    $data[$key] = $value; // Change data with subObject
                }
            }
        }

        return $object;
    }