@param object $entity

@return HydratorInterface
359417
public function create($entity)
    {
        $class = ClassUtils::getClass($entity);

        if (!isset($this->instances[$class])) {
            $config        = new Configuration($class);
            $hydratorClass = $config->createFactory()->getHydratorClass();

            $this->instances[$class] = new $hydratorClass();
        }

        return $this->instances[$class];
    }
1163775
public function remove($entity)
    {
        $key = get_class($entity).'::'.$entity->getId();
        $this->getCache()->erase($key);
        return $this;
    }
961077
public function hydrate(array $data, $object)
    {
        $object->setId($this->getData('id', $data));
        $object->setName($this->getData('name', $data));
        return $object;
    }
1011286
public function hydrate(array $data, $object)
    {
        if (! $object instanceof Entity) {
            return $object;
        }
                
        parent::hydrate($data, $object);
               
        $authEntity = parent::hydrate($data, new \Pacificnm\Auth\Entity\Entity());
        
        $object->setAuthEntity($authEntity);
        
        $aclRoleEntity = parent::hydrate($data, new \Pacificnm\AclRole\Entity\Entity());
        
        $object->getAuthEntity()->setAclRoleEntity($aclRoleEntity);
        
        return $object;
    }
511339
protected function hydrateObjectForm($object)
    {
        $data = array(
            "id" => $object->getId(),
            "visible" => (bool) $object->getVisible(),
            "code" => $object->getCode(),
            "title" => $object->getTitle(),
            "type" => $object->getType(),
            "entity" => $object->getEntity(),
            "serialized_columns" => $object->getSerializedColumns(),
            "serialized_condition" => $object->getSerializedCondition(),
            "index_engine_driver_configuration_id" => $object->getIndexEngineDriverConfigurationId(),
        );

        return $this->getUpdateForm($data);
    }
820972
public function hydrate(array $data, $object)
    {
        $object->setId($this->getData('id', $data));
        $object->setName($this->getData('name', $data));
        $object->setType($this->getData('type', $data));
        $object->setOrdering($this->getData('ordering', $data));
        $object->setIncludePattern($this->getData('include_pattern', $data));
        $object->setExcludePattern($this->getData('exclude_pattern', $data));
        return $object;
    }
1092237
public function eql($entity)
    {
        if ($entity instanceof AnDomainEntityProxy) {
            $object = $entity->getObject();
        } elseif ($entity instanceof AnMixinAbstract) {
            $object = $entity->getMixer();
        } else {
            $object = $entity;
        }

        return $this === $object;
    }
1289488
private static function getHydratorClosure($object)
    {
        if (!isset(self::$hydratorClosure)) {
            self::$hydratorClosure = function($object, array $data) {
                foreach ($data as $name => $value) {
                    $object->$name = $value;
                }
            };
        }

        $class = get_class($object);

        if (!isset(self::$hydratorClosureCache[$class])) {
            self::$hydratorClosureCache[$class] = \Closure::bind(self::$hydratorClosure, null, $class);
        }

        return self::$hydratorClosureCache[$class];
    }
79652
public function createHydratorFor($objectClass)
    {
        $metadata = $this->getMetadata($objectClass);
        $propertyAccessStrategy = $metadata->isPropertyAccessStrategyEnabled();

        $hydrator = new Hydrator\Hydrator($this, $propertyAccessStrategy);
        if ($this->classResolver) {
            $hydrator->setClassResolver($this->classResolver);
        }

        $fieldsWithHydrationStrategy = $metadata->computeFieldsWithHydrationStrategy();

        $mappedFieldNames = $metadata->getMappedFieldNames();

        foreach ($mappedFieldNames as $mappedFieldName) {

            $strategy = null;

            if ($metadata->isMappedFieldWithStrategy($mappedFieldName)) {

                $fieldStrategy = $fieldsWithHydrationStrategy[$mappedFieldName];
                $strategy = new ClosureHydrationStrategy(
                    $fieldStrategy[$metadata::INDEX_EXTRACTION_STRATEGY],
                    $fieldStrategy[$metadata::INDEX_HYDRATION_STRATEGY]
                );
            }

            if ($metadata->isMappedDateField($mappedFieldName)) {

                $readDateConverter = $metadata->getReadDateFormatByMappedField($mappedFieldName, null);
                $writeDateConverter = $metadata->getWriteDateFormatByMappedField($mappedFieldName, null);

                if (! is_null($readDateConverter) && ! is_null($writeDateConverter)) {
                    $strategy = new DateHydrationStrategy($readDateConverter, $writeDateConverter, $strategy);
                } else {
                    throw new ObjectMappingException(
                        sprintf(
                            'The date field "%s" should provide "readDateConverter" and "writeDateConverter" metadata.',
                            $mappedFieldName
                        )
                    );
                }
            }

            if (! is_null($strategy)) {
                $hydrator->addStrategy($mappedFieldName, $strategy);
            }
        }

        //------------------------------------------------------------------------------------------
        if ($metadata->eventsExist()) {
            $hydrator = new Hydrator\EventHydrator($hydrator, $this);
        }

        return $hydrator;
    }
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);
    }
891611
public function hydrate(array $data, $object)
    {
        $this->prepare($object);

        if (isset($this->onBeforeHydrate)) {

            if (! isset($this->metadataExtensionClass)) {
                call_user_func_array([$object, $this->onBeforeHydrate], [new HydrationContext($data)]);
            } else {
                call_user_func_array([$this->metadataExtensionClass, $this->onBeforeHydrate], [new HydrationContext($data), $object]);
            }
        }

        $object = parent::hydrate($data, $object);

        if (isset($this->onAfterHydrate)) {

            if (! isset($this->metadataExtensionClass)) {
                call_user_func_array([$object, $this->onAfterHydrate], [new ImmutableHydrationContext($data)]);
            } else {
                call_user_func_array([$this->metadataExtensionClass, $this->onAfterHydrate], [new ImmutableHydrationContext($data), $object]);
            }

        }

        return $object;
    }
533458
protected function hydrateObjectForm($object)
    {
        $data = [
            'id'        => $object->getId(),
            'hook_id'   => $object->getHookId(),
            'module_id' => $object->getModuleId(),
            'classname' => $object->getClassname(),
            'method'    => $object->getMethod(),
            'active'    => $object->getActive(),
            'templates' => $object->getTemplates(),
        ];

        return $this->createForm(AdminForm::MODULE_HOOK_MODIFICATION, 'form', $data);
    }
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);
    }
1097691
public function hydrate(array $data, $object)
    {
        foreach ($data as $key => $value) {

            $hydrateName = $this->hydrateName($key);

            if ($object->has($hydrateName)) {
                $method = 'set' . ucfirst($hydrateName);
                $value = $this->hydrateValue($hydrateName, $value, $data);
                $object->$method($value);
            }
        }

        return $object;
    }
71954
protected function hydrateObjectForm($object)
    {
        $data = array(
            "id" => $object->getId(),
            "code" => $object->getCode(),
            "driver_code" => $object->getDriverCode(),
            "title" => $object->getTitle(),
            "serialized_configuration" => $object->getSerializedConfiguration(),
        );

        return $this->getUpdateForm($data);
    }
334553
public function load(string $class): HydratorInterface
    {
        if (isset($this->hydrators[$class])) {
            return $this->hydrators[$class];
        }

        /** @var ClassMetadata $classMetadata */
        $classMetadata = $this->metadataFactory->getMetadataForClass($class);

        if (null === $classMetadata) {
            throw new \RuntimeException(
                'No mapping file was found for class '.$class.
                '. Did you configure the correct paths for serializer?'
            );
        }

        $fqn = $this->configuration->getFQNClassName($classMetadata);

        if (\class_exists($fqn, false)) {
            return $this->hydrators[$class] = $this->factory->newInstance($classMetadata);
        }

        $this->compileAndLoad($classMetadata);

        return $this->hydrators[$class] = $this->factory->newInstance($classMetadata);
    }
536213
public function hydrate( array $data, $object )
    {
        if ( isset( $data['properties'] ) &&
             is_array( $data['properties'] ) )
        {
            foreach ( $data['properties'] as $key => $value )
            {
                $newKey = String::decamelize( $key );

                if ( $newKey != $key )
                {
                    $data['properties'][$newKey] = $value;
                    unset( $data['properties'][$key] );
                }
            }
        }

        return $this->getMapper()
                    ->hydrate( $data, $object );
    }