public function hydrateEntity(EntityInterface $entity, array $values)
    {
        foreach ($values as $value) {
            if (!$this->_toolbox->propertyExists($entity, $value['property_name'])) {
                $entity->set($value['property_name'], $value['value']);
                $entity->dirty($value['property_name'], false);
            }
        }

        // force cache-columns to be of the proper type as they might be NULL if
        // entity has not been updated yet.
        if ($this->config('cacheMap')) {
            foreach ($this->config('cacheMap') as $column => $fields) {
                if ($this->_toolbox->propertyExists($entity, $column) && !($entity->get($column) instanceof Entity)) {
                    $entity->set($column, new Entity);
                }
            }
        }

        return $entity;
    }
public function hydrateEntity(EntityInterface $entity, array $values)
    {
        foreach ($values as $value) {
            if (!$this->_toolbox->propertyExists($entity, $value['property_name'])) {
                $entity->set($value['property_name'], $value['value']);
                $entity->dirty($value['property_name'], false);
            }
        }

        // force cache-columns to be of the proper type as they might be NULL if
        // entity has not been updated yet.
        if ($this->config('cacheMap')) {
            foreach ($this->config('cacheMap') as $column => $fields) {
                if ($this->_toolbox->propertyExists($entity, $column) && !($entity->get($column) instanceof Entity)) {
                    $entity->set($column, new Entity);
                }
            }
        }

        return $entity;
    }
public function hydrateEntity ( EntityInterface $ entity , array $ values ) { foreach ( $ values as $ value ) { if ( ! $ this -> _toolbox -> propertyExists ( $ entity , $ value [ 'property_name' ] ) ) { $ entity -> set ( $ value [ 'property_name' ] , $ value [ 'value' ] ) ; $ entity -> dirty ( $ value [ 'property_name' ] , false ) ; } } // force cache-columns to be of the proper type as they might be NULL if // entity has not been updated yet. if ( $ this -> config ( 'cacheMap' ) ) { foreach ( $ this -> config ( 'cacheMap' ) as $ column => $ fields ) { if ( $ this -> _toolbox -> propertyExists ( $ entity , $ column ) && ! ( $ entity -> get ( $ column ) instanceof Entity ) ) { $ entity -> set ( $ column , new Entity ) ; } } } return $ entity ; }
Hydrates a single entity and returns it.

Returning NULL indicates the entity should be removed from the resulting
collection.

@param \Cake\Datasource\EntityInterface $entity The entity to hydrate
@param array $values Holds stored virtual values for this particular entity
@return bool|null|\Cake\Datasource\EntityInterface
Hydrates a single entity and returns it .