2017 © Pedro Peláez
 

yii2-extension yii2-behavior-subset

Behavior Subset

image

suver/yii2-behavior-subset

Behavior Subset

  • Saturday, October 8, 2016
  • by suver
  • Repository
  • 1 Watchers
  • 0 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 40 % Grown

The README.md

Frapse Behavior Subset

Behavior Subset, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require suver/yii2-behavior-subset

or add, (*4)

"suver/yii2-behavior-subset": "*"

to the require section of your composer.json file., (*5)

Configure

Write you behaviors section like this for Many-To-Many, (*6)

public function behaviors()
{
    return [
        [
            'class' => '\suver\behavior\Subset',
            'relation' => 'authors', // you relation
            'attribute' => 'authors_ids',
        ]
    ];
}

/**
 * Relation with Other Model
 *
 * @return \yii\db\ActiveQuery
 */
public function getAuthors()
{
    return $this->hasMany(OtherModel::className(), ['id' => 'other_model_id'])->viaTable('this_model_to_other_model', ['this_model_id' => 'id']);
}

Usage

Once the extension is installed, simply use it in your code by :, (*7)


// save relation $model->authors_ids = [1,2,3,4]; $model->save(); // get realtion var_dump($model->authors)

yii2-behavior-subset

Behavior subset. Esey work with many to many relations, (*8)

The Versions

08/10 2016

dev-master

9999999-dev

Behavior Subset

  Sources   Download

Apache-2.0

The Requires

 

extension yii2 behavior subset farpse

08/10 2016

1.0.2

1.0.2.0

Behavior Subset

  Sources   Download

Apache-2.0

The Requires

 

extension yii2 behavior subset farpse

07/10 2016

v1.0.0

1.0.0.0

Behavior Subset

  Sources   Download

Apache-2.0

The Requires

 

extension yii2 behavior subset farpse