Hydrate $object with the provided $data.

@param array<string, mixed> $data
@param object $object

@return mixed
554411
public function hydrate(array $data, $object)
    {
        if (!is_object($object)) {
            throw new RuntimeException(
                sprintf('%s expects the provided $object to be a PHP object', __METHOD__)
            );
        }

        return (function (array $data) {
            foreach ($data as $property => $value) {
                if (!property_exists($this, $property)) {
                    throw new RuntimeException(
                        sprintf(
                            'Property "%s" does not exist in "%s" class.',
                            $property,
                            get_class($this)
                        )
                    );
                }

                $this->{$property} = $value;
            }

            return $this;
        })->call($object, $data);
    }
179683
public function hydrate(array $data, $object)
    {
        if (!$object instanceof TicketSubject) {
            throw new \InvalidArgumentException('$object must be an instance of TicketSubject');
        }

        return parent::hydrate($data, $object);
    }
950181
public function hydrate(&$object, $datas, $soft = false, $maxReferenceDepth = 10)
    {
        $stream = $object->getStream();
        if (isset($datas['stream'])) {
            $stream = $datas['stream'];
            unset($datas['stream']);
        }

        if (isset($datas["metadata"])) {
            $metadata = $datas["metadata"];
            $datas = array_merge((array) $datas, (array) $metadata);
            unset($datas["metadata"]);
        }
        parent::hydrate($object, $datas, $soft, $maxReferenceDepth);

        if (isset($stream)) {
            $object->setStream($stream);
        }
    }
1236891
public function hydrate(array $data, $object)
    {
        $object->setId($data['id']);
        $object->setCreatedAt(new \DateTime($data['created_at']));
        $object->setCreatedBy($data['created_by']);
        $object->setComment($data['comment']);
        return $object;
    }
719485
private function hydrate($object_data) {
    //if (is_array($object_data)) {
      foreach ($object_data as $object_data_key => $object_data_value) {
        if(method_exists($this, $object_data_key)) {
          if ($object_data_value == '') {
            $object_data_value = null;
          }
          $this->{'set'.ucfirst($object_data_key)}($object_data_value);
        }
      }
    //}
    /* else if (is_a($object_data, get_class($this))) {
      foreach ($this->properties() as $properties_key => $properties_value) {
        $this->{'set'.ucfirst($properties_value)}($object_data->$properties_value());
      }
    }/* else {
      throw new XException('00010003', 4, array( 0 => get_class($this) ));
    }*/
  }
1124241
protected function hydrateObjectForm($object)
    {
        $data = array(
            'area_id' => $object->getId(),
            'name' => $object->getName()
        );

        return $this->createForm(AdminForm::AREA_MODIFICATION, 'form', $data);
    }
958256
public function hydrate(array $data, $object)
    {
        if (!$object instanceof Request) {
            throw new \Exception('$object must be an instance of Request');
        }

        return parent::hydrate($data, $object);
    }
56972
public function hydrate(array $data, $object)
    {
        parent::hydrate($data, $object);
        if (isset($data['certname'])) {
            $object->setName($data['certname']);
        }
        if (isset($data['facts-timestamp'])) {
            $object->setReportedAt(new \DateTime($data['facts-timestamp']));
        }
        if (isset($data['facts-environment'])) {
            $object->setEnvironment($data['facts-environment']);
        }
        return $object;
    }
867722
public function hydrate(&$object, $data, $soft = false, $maxReferenceDepth = 10)
    {
        $strategy = $this->documentManager->getOptions()['hydratorStrategy'] ?? self::STRAT_SETTERS;
        $reflectionClass = new \ReflectionClass($this->classMetadata->getName());
        if ($data instanceof \MongoDB\Model\BSONArray || $data instanceof \MongoDB\Model\BSONDocument) {
            $data = (array) $data;
        }

        if (!is_array($data)) {
            throw new \Exception('$data must be an array');
        }
        $properties = $this->classMetadata->getPropertiesInfos();

        foreach ($properties as $name => $infos) {
            $setter = 'set' . ucfirst($name);
            if (!$reflectionClass->hasMethod($setter) || $strategy === self::STRAT_ATTRIBUTES) {
                $prop = new \ReflectionProperty($this->classMetadata->getName(), $name);
                $prop->setAccessible(true);
            } else {
                $prop = null;
            }

            if (null !== ($field = $infos->getField())) {
                if (!$soft && !array_key_exists($field, $data)) {
                    $this->setValue($object, null, $setter, $prop);
                } elseif (array_key_exists($field, $data)) {
                    if (!$soft && $data[$field] === null) {
                        continue;
                    }
                    if ((($data[$field] instanceof \MongoDB\Model\BSONDocument) || is_array($data[$field])) && $infos->getEmbedded() && null !== ($class = $infos->getEmbeddedClass())) {
                        if ($infos->isDiscriminable()) {
                            if (null !== ($discrimatorField = $infos->getDiscriminatorField())
                                && null !== ($discrimatorMap = $infos->getDiscriminatorMap())) {
                                $discriminatorValue = isset($data[$field][$discrimatorField]) ? $data[$field][$discrimatorField] : null;
                                if (isset($discriminatorValue)) {
                                    $class = isset($discrimatorMap[$discriminatorValue]) ? $discrimatorMap[$discriminatorValue] : $class;
                                }
                            } else {
                                $discriminatorValue = isset($data[$field]) ? $data[$field] : null;
                                $method = $infos->getDiscriminatorMethod();
                                $class = $object->$method($discriminatorValue);
                            }
                        }
                        if (!class_exists($class)) {
                            $class = $this->classMetadata->getNamespace() . "\\" . $class;
                        }
                        if ($data[$field] instanceof $class) {
                            $embedded = $data[$field];
                        } else {
                            $embedded = new $class();
                            $this->getHydrator($class)->hydrate($embedded, $data[$field]);
                        }
                        $data[$field] = $embedded;
                    } elseif ((($data[$field] instanceof \MongoDB\Model\BSONArray) || ($data[$field] instanceof \MongoDB\Model\BSONDocument) || is_array($data[$field])) && $infos->getMultiEmbedded() && null !== ($class = $infos->getEmbeddedClass())) {
                        $array = [];
                        $originalClass = $class;
                        foreach ($data[$field] as $key => $value) {
                            if ($infos->isDiscriminable()) {
                                if (null !== ($discrimatorField = $infos->getDiscriminatorField())
                                    && null !== ($discrimatorMap = $infos->getDiscriminatorMap())) {
                                    $discriminatorValue = isset($data[$field][$key][$discrimatorField]) ? $data[$field][$key][$discrimatorField] : null;
                                    if (isset($discriminatorValue)) {
                                        $class = isset($discrimatorMap[$discriminatorValue]) ? $discrimatorMap[$discriminatorValue] : $originalClass;
                                    }
                                    if (!class_exists($class)) {
                                        $class = $this->classMetadata->getNamespace() . "\\" . $class;
                                    }
                                } else {
                                    //call_s
                                }
                            }
                            if (!class_exists($class)) {
                                $class = $this->classMetadata->getNamespace() . "\\" . $originalClass;
                            }
                            if ($value === null) {
                                continue;
                            }

                            if ($value instanceof $class) {
                                $embedded = $value;
                            } else {
                                $embedded = new $class();
                                $this->getHydrator($class)->hydrate($embedded, $value);
                            }
                            $array[$key] = $embedded;
                        }
                        $data[$field] = $array;
                    } elseif (null !== ($refInfos = $infos->getReferenceInfo()) && !$refInfos->getIsMultiple() && $maxReferenceDepth > 0) {
                        $repository = $this->repositoryFactory->getRepository($this->documentManager, $refInfos->getDocument(), $refInfos->getCollection());

                        $objectDatas = $repository->getCollection()->findOne(["_id" => $data[$field]]);
                        $referedObject = null;

                        if (isset($objectDatas)) {
                            $class = $refInfos->getDocument();

                            if (!class_exists($class)) {
                                $class = $this->classMetadata->getNamespace() . "\\" . $class;
                            }

                            $referedObject = new $class();

                            $hydrator = $repository->getHydrator();
                            $hydrator->hydrate($referedObject, $objectDatas, $soft, $maxReferenceDepth - 1);
                        }
                        $data[$field] = $referedObject;
                    } elseif (null !== ($refInfos = $infos->getReferenceInfo()) && $refInfos->getIsMultiple()) {
                        $repository = $this->repositoryFactory->getRepository($this->documentManager, $refInfos->getDocument(), $refInfos->getCollection());

                        if (!$data[$field] instanceof \MongoDB\Model\BSONArray && !is_array($data[$field])) {
                            throw new \Exception("RefersMany value must be an array for document with '_id' : " . $data["_id"]);
                        } else {
                            $objectsDatas = $repository->getCollection()->find(["_id" => ['$in' => $data[$field]]]);
                        }

                        $objectArray = null;

                        if (!empty($objectsDatas)) {
                            $objectArray = [];
                            foreach ($objectsDatas as $objectDatas) {
                                $class = $refInfos->getDocument();

                                if (!class_exists($class)) {
                                    $class = $this->classMetadata->getNamespace() . "\\" . $class;
                                }

                                $referedObject = new $class();

                                $hydrator = $repository->getHydrator();
                                $hydrator->hydrate($referedObject, $objectDatas, $soft, $maxReferenceDepth - 1);

                                $objectArray[] = $referedObject;
                            }
                        }
                        $data[$field] = $objectArray;
                    }

                    $this->setValue($object, $data[$field], $setter, $prop);
                }
            }
        }
    }
757518
public function hydrate(array $data, $object)
    {
        if (isset($data['name'])) {
            $object->setName($data['name']);
        }
        if (isset($data['facts_timestamp'])) {
            $object->setReportedAt(new \DateTime($data['facts_timestamp']));
        }
        return $object;
    }
1321723
public function hydrate(array $data, $object)
    {
        parent::hydrate($data, $object);

        foreach ($this->getFreeValuesKeys() as $key) {
            if (isset($data[$key])) {
                $object->set($key, $data[$key]);
            }
        }

        return $object;
    }
1229253
public function hydrate(array $data, $object)
    {
        $methods = array_flip(get_class_methods(get_class($object)));
        $class = get_class($object);

        foreach ($data as $key => $value) {
            $method = StringUtil::camel('set_' . $key);

            if (!isset($methods[$method])) {
                continue;
            }

            $object->$method($this->getValue($class, $method, $value));
        }

        return $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;
    }
500164
public function hydrate(array $data, $object)
    {
        if (!$object instanceof DownloadList) {
            throw new Exception('$object must be an instance of Downloadlist');
        }

        return parent::hydrate($data, $object);
    }
736025
private function getHydrator($object)
    {
        $class = get_class($object);

        if (!isset(self::$hydratorCache[$class])) {
            $hydratorClass = $this->generator->getHydratorClass($class);

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

        return self::$hydratorCache[$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);
    }
1054333
protected function hydrateObjectForm($object)
    {
        // Prepare the data that will hydrate the form
        $data = [
            'id'            => $object->getId(),
            'locale'        => $object->getLocale(),
            'title'         => $object->getTitle(),
            'chapo'         => $object->getChapo(),
            'description'   => $object->getDescription(),
            'postscriptum'  => $object->getPostscriptum(),
            'color'         => $object->getColor(),
            'code'          => $object->getCode()
        ];

        $form = $this->createForm(AdminForm::ORDER_STATUS_MODIFICATION, "form", $data);

        // Setup the object form
        return $form;
    }