framework/behaviors/OptimisticLockBehavior.php
protected function getValue($event)
    {
        if ($this->value === null) {
            $request = Yii::$app->getRequest();
            $lock = $this->getLockAttribute();
            $formName = $this->owner->formName();
            $formValue = $formName ? ArrayHelper::getValue($request->getBodyParams(), $formName . '.' . $lock) : null;
            $input = $formValue ?: $request->getBodyParam($lock);
            $isValid = $input && (new NumberValidator())->validate($input);
            return $isValid ? $input : 0;
        }

        return parent::getValue($event);
    }
protected function getValue($event)
    {
        if ($this->value === null) {
            $request = Yii::$app->getRequest();
            $lock = $this->getLockAttribute();
            $formName = $this->owner->formName();
            $formValue = $formName ? ArrayHelper::getValue($request->getBodyParams(), $formName . '.' . $lock) : null;
            $input = $formValue ?: $request->getBodyParam($lock);
            $isValid = $input && (new NumberValidator())->validate($input);
            return $isValid ? $input : 0;
        }

        return parent::getValue($event);
    }
protected function getValue ( $ event ) { if ( $ this -> value === null ) { $ request = Yii :: $ app -> getRequest ( ) ; $ lock = $ this -> getLockAttribute ( ) ; $ formName = $ this -> owner -> formName ( ) ; $ formValue = $ formName ? ArrayHelper :: getValue ( $ request -> getBodyParams ( ) , $ formName . '.' . $ lock ) : null ; $ input = $ formValue ? : $ request -> getBodyParam ( $ lock ) ; $ isValid = $ input && ( new NumberValidator ( ) ) -> validate ( $ input ) ; return $ isValid ? $ input : 0 ; } return parent :: getValue ( $ event ) ; }
{@inheritdoc}

In case of `null`, value will be parsed from [[\yii\web\Request::getBodyParam()|getBodyParam()]] or set to 0.
{ @inheritdoc }