public function update($name, $value, $autoload = null, $callbacks = true)
    {
        $option = $this
            ->find()
            ->where(['name' => $name])
            ->first();

        if (!$option) {
            return null;
        }

        if ($callbacks) {
            $option->set('value', $value);

            if ($autoload !== null) {
                $option->set('autoload', $autoload);
            }

            return $this->save($option, ['callbacks' => false]);
        }

        return $this->updateAll(['value' => $value], ['name' => $name]);
    }
public function update($name, $value, $autoload = null, $callbacks = true)
    {
        $option = $this
            ->find()
            ->where(['name' => $name])
            ->first();

        if (!$option) {
            return null;
        }

        if ($callbacks) {
            $option->set('value', $value);

            if ($autoload !== null) {
                $option->set('autoload', $autoload);
            }

            return $this->save($option, ['callbacks' => false]);
        }

        return $this->updateAll(['value' => $value], ['name' => $name]);
    }
public function update ( $ name , $ value , $ autoload = null , $ callbacks = true ) { $ option = $ this -> find ( ) -> where ( [ 'name' => $ name ] ) -> first ( ) ; if ( ! $ option ) { return null ; } if ( $ callbacks ) { $ option -> set ( 'value' , $ value ) ; if ( $ autoload !== null ) { $ option -> set ( 'autoload' , $ autoload ) ; } return $ this -> save ( $ option , [ 'callbacks' => false ] ) ; } return $ this -> updateAll ( [ 'value' => $ value ] , [ 'name' => $ name ] ) ; }
Updates the given option.

@param string $name Option name
@param mixed $value Value to store for this option
@param bool|null $autoload Set to true to load this option on bootstrap,
null indicates it should not be modified. Defaults to null (do not change)
@param bool $callbacks Whether to trigger callbacks (beforeSavem etc) or not.
Defaults to true
@return null|\Cake\ORM\Entity The option as an entity on success, null otherwise
Updates the given option .