2017 © Pedro Peláez
 

library yii-array-field

Yii array field behavior

image

petrgrishin/yii-array-field

Yii array field behavior

  • Thursday, June 26, 2014
  • by petrgrishin
  • Repository
  • 1 Watchers
  • 2 Stars
  • 151 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

yii-array-field

Travis CI Coverage Status, (*1)

Yii array field behavior, for simple storage array in you model, (*2)

Installation

Add a dependency to your project's composer.json:, (*3)

{
    "require": {
        "petrgrishin/yii-array-field": "~2.0"
    }
}

Usage examples

Attach behavior to you model

Model have text attribute data for storage array, (*4)

namespace app\models;

use \CActiveRecord as ActiveRecord;
use \PetrGrishin\ArrayField\ArrayAccessFieldBehavior;

class Model extends ActiveRecord {
    public function behaviors() {
        return array(
            'arrayField' => array(
                'class' => ArrayAccessFieldBehavior::className(),
                'fieldNameStorage' => 'data',
            )
        );
    }

}

Usage behavior

$model = Model::find(1)->one();
$model->arrayField->setValue('a.b', true);
$value = $model->arrayField->getValue('a.b');
$array = $model->arrayField->getArray();

Save only array field

$model = Model::find(1)->one();
$model->arrayField->setValue('a.b', true);
$model->arrayField->save();

The Versions

26/06 2014

dev-master

9999999-dev

Yii array field behavior

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

26/06 2014

2.0.0

2.0.0.0

Yii array field behavior

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

23/05 2014

1.0.1

1.0.1.0

Yii array field behavior

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin

19/05 2014

1.0.0

1.0.0.0

Yii array field behavior

  Sources   Download

MIT

The Requires

 

The Development Requires

by Petr Grishin