beastbytes / yii2-wizard

Yii2 Extension to handle multi-part form wizards
Other
37 stars 21 forks source link

Saving stepData on Session - issues #11

Open marko85to opened 8 years ago

marko85to commented 8 years ago

Hi, thanks for your extension, it's really nice.

I have experienced some issues in the "saveStep" function and I thought I would share it with everyone. Basically I have noticed that the data stored in the session was not always updating when submitting the forms. I've had to unset the variable in the session before updating the data, as you can see below:

WizardBehavior.php

protected function saveStep($step, $data)
    {
        if (!isset($this->_session[$this->_stepDataKey][$step])) {
            $this->_session[$this->_stepDataKey][$step] = new \ArrayObject;
        }
        unset($this->_session[$this->_stepDataKey][$step]);
        $this->_session[$this->_stepDataKey][$step][] = $data;
    }

After this update things seems working fine.