yii2

Convert the model to an array in yii2

The simplest way of converting a model into an array is to use the yii\base\Model::$attributes property. For example, By default, the yii\base\Model::$attributes property will return the values of all attributes declared in yii\base\Model::attributes(). A more flexible and powerful way of converting a model into an array is to use the yii\base\Model::toArray() method. Its default behavior is the same as that of yii\base\Model::$attributes. However, it allows …

Convert the model to an array in yii2 Read More »