hydrate

@param array $meta
@param mixed $data

@return mixed

@throws TExceptionAbstract
557043
private function hydrate($meta, $data)
    {
        $property = array_key_exists('property', $meta) ? $meta['property'] : null;
        $format   = array_key_exists('format', $meta) ? $meta['format'] : null;
        $type     = array_key_exists('type', $meta) ? $meta['type'] : null;

        switch ($type) {
            case Types::TYPE_STRING:
            case Types::TYPE_DATE:
                return $this->stringValidator->validate($property, $data, $format);
            case Types::TYPE_INT:
                return $this->intValidator->validate($property, $data, $format);
            case Types::TYPE_FLOAT:
                return $this->floatValidator->validate($property, $data, $format);
            case Types::TYPE_JSON:
                return $this->jsonValidator->validate($property, $data, $format);
        }

        return $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;
    }
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;
    }
341547
public function hydrate(array $data, $object)
    {
        if (isset($data['name'])) {
            $object->setName($data['name']);
        }
        if (isset($data['doc'])) {
            $object->setDocumentation($data['doc']);
        }
        if (isset($data['parameters_definitions']) && is_array($data['parameters_definitions'])) {
            $object->setParametersDefinitions($data['parameters_definitions']);
        }
        if (isset($data['template_definitions']) && is_array($data['template_definitions'])) {
            $object->setParametersTemplates($data['template_definitions']);
        }
        return $object;
    }
371640
public function hydrate(array $data, $object)
    {
        $object->setId(isset($data['e.id']) ? $data['e.id'] : $data['id']);
        $object->setName(isset($data['e.name']) ? $data['e.name'] : $data['name']);
        $object->setDefault(isset($data['e.isdefault']) ? $data['e.isdefault'] == 1 : $data['isdefault'] == 1);
        return $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;
    }
467613
public function hydrate( array $data, $structure )
    {
        if ( ! empty( $data['file'] ) )
        {
            if ( ! empty( $data['file']['tmp_name'] ) )
            {
                $data['name'] = $data['file']['name'];
                $data['code'] = @ file_get_contents( $data['file']['tmp_name'] );
                @ unlink( $data['file']['tmp_name'] );
            }

            unset( $data['file'] );
        }

        if ( ! empty( $data['type'] ) )
        {
            $data['name'] .= '.' . $data['type'];
            unset( $data['type'] );
        }

        if ( $structure instanceof StructureAbstract )
        {
            $structure->setOptions( $data );
        }
        else
        {
            foreach ( $data as $key => $value )
            {
                $structure->$key = $value;
            }
        }

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        return $structure;
    }
1141256
protected function hydrateAssociations($entity, $data)
    {
        if (isset($data['relationships']) && is_array($data['relationships'])) {
            $metadata = $this->entityManager->getClassMetadata(get_class($entity));

            foreach ($data['relationships'] as $name => $data) {
                if (!isset($metadata->associationMappings[$name])) {
                    throw new \Exception(sprintf('Relation `%s` association not found', $name));
                }

                $mapping = $metadata->associationMappings[$name];

                if (is_array($data['data'])) {
                    if ($resourceId = $this->getResourceId($data['data'])) {
                        $this->hydrateToOneAssociation($entity, $name, $mapping, $resourceId);
                    } else {
                        $this->hydrateToManyAssociation($entity, $name, $mapping,
                            $this->mapRelationshipsArray($data['data'])
                        );
                    }
                }
            }
        }

        return $entity;
    }
686367
public function hydrate(array $data, $object)
    {
        if (!$object instanceof SecretQuestion) {
            throw new \Exception('$object must be an instance of SecretQuestion');
        }

        return parent::hydrate($data, $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);
    }
626551
function withMeta($data)
    {
        $meta = $this->_assertMetaData($data);

        $new = clone $this;
        $new->meta = array_merge($this->meta, $meta);
        return $new;
    }
1304357
public function hydrate( array $data, $structure )
    {
        if ( $structure instanceof Structure )
        {
            $structure->setOptions( $data );
        }
        else
        {
            foreach ( $data as $key => $value )
            {
                $structure->$key = $value;
            }
        }

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        return $structure;
    }
53983
public function hydrate(array $data, $object)
    {
        if (!$object instanceof UserBlock) {
            throw new \Exception('$object must be an instance of UserBlock');
        }

        return parent::hydrate($data, $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;
    }
1112420
public function hydrateValue($name, $value, $data = null)
    {
        $value = parent::hydrateValue($name, $value, $data);

        if (is_null($value) && $this->isNullable($name)) {
            return null;
        }

        return $this->handleTypeConversions($value, $this->metadata->getTypeOfField($name));
    }
264224
public function hydrate(array $data, $object)
    {
        $object->setId($this->getData('id', $data));
        $releasedAt = $this->getData('released_at', $data);
        $object->setReleasedAt(isset($releasedAt) ? new \DateTime($releasedAt) : null);
        $object->setReleasedBy($this->getData('released_by', $data));
        $object->setComment($this->getData('comment', $data));
        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;
    }