public function touch(EntityInterface $entity, $eventName = 'Model.beforeSave')
    {
        $events = $this->_config['events'];
        if (empty($events[$eventName])) {
            return false;
        }

        $return = false;
        $refresh = $this->_config['refreshTimestamp'];

        foreach ($events[$eventName] as $field => $when) {
            if (in_array($when, ['always', 'existing'])) {
                $return = true;
                $entity->setDirty($field, false);
                $this->_updateField($entity, $field, $refresh);
            }
        }

        return $return;
    }
public function touch(EntityInterface $entity, $eventName = 'Model.beforeSave')
    {
        $events = $this->_config['events'];
        if (empty($events[$eventName])) {
            return false;
        }

        $return = false;
        $refresh = $this->_config['refreshTimestamp'];

        foreach ($events[$eventName] as $field => $when) {
            if (in_array($when, ['always', 'existing'])) {
                $return = true;
                $entity->setDirty($field, false);
                $this->_updateField($entity, $field, $refresh);
            }
        }

        return $return;
    }
public function touch ( EntityInterface $ entity , $ eventName = 'Model.beforeSave' ) { $ events = $ this -> _config [ 'events' ] ; if ( empty ( $ events [ $ eventName ] ) ) { return false ; } $ return = false ; $ refresh = $ this -> _config [ 'refreshTimestamp' ] ; foreach ( $ events [ $ eventName ] as $ field => $ when ) { if ( in_array ( $ when , [ 'always' , 'existing' ] ) ) { $ return = true ; $ entity -> setDirty ( $ field , false ) ; $ this -> _updateField ( $ entity , $ field , $ refresh ) ; } } return $ return ; }
Touch an entity

Bumps timestamp fields for an entity. For any fields configured to be updated
"always" or "existing", update the timestamp value. This method will overwrite
any pre-existing value.

@param \Cake\Datasource\EntityInterface $entity Entity instance.
@param string $eventName Event name.
@return bool true if a field is updated, false if no action performed
Touch an entity