ActiveRecord load method

Does the active method load method run the validations as well as load the data into the model?

No one know the answer to this?

Consider looking at the API - it will save you time and frustration.


 public function load($data, $formName = null)

    {

        $scope = $formName === null ? $this->formName() : $formName;

        if ($scope === '' && !empty($data)) {

            $this->setAttributes($data);

            return true;

        } elseif (isset($data[$scope])) {

            $this->setAttributes($data[$scope]);

            return true;

        } else {

            return false;

        }

    }

All load() does is populate a model with form data. It is shorthand for looping through the $_POST array and assigning variables, or the Yii 1.1.x way of using $model->attributes.

So, no. It does not run validation.

Ohh yes, for some reason I forgot I could do that, always use to do it with Yii 1 but never considered it with Yii 2.

Thanks.