sam-it/yii2-jsonbehavior Advanced AR JSON support

Scrutinizer Code Quality Code Coverage Build Status Total Downloads Latest Stable Version

Yii2 JsonBehavior

Work with JSON fields in Yii2

This behavior adds advanced support for working with JSON data in Yii AR models.

Use JSON fields like normal fields

Consider a model having a data attribute that is stored as JSON. `` public function behaviors() {

return [
    ['class' => JsonBehavior::class, 'jsonAttributes' => ['data']]
];

}

// Examples: $model = new Model(); $model->a = "test"; // If attribute 'a' does not exist this is stored inside the data.

$model->a['b'] = 'c']; // Nested arrays are supported.

$model->data = ['x' => 'y']; // Assigning directly is supported. ``

1 0
1 follower
1 011 downloads
Yii Version: Unknown
License: MIT
Category: Database
Developed by: sammousa
Created on: Sep 7, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions