2017 © Pedro Peláez
 

yii2-extension yii2-behavior-relation-follow

image

diiimonn/yii2-behavior-relation-follow

  • Monday, February 23, 2015
  • by diiimonn
  • Repository
  • 2 Watchers
  • 0 Stars
  • 40 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

yii2-behavior-relation-follow

Model behavior for relation data management, (*1)

Installation

To install with composer:, (*2)

$ php composer.phar require diiimonn/yii2-behavior-relation-follow "dev-master"

or add, (*3)

"diiimonn/yii2-behavior-relation-follow": "dev-master"

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

Usage

in MyModel.php

...
use diiimonn\behaviors\RelationFollowBehavior;
...

public function behaviors()
{
    return [
        ...
        [
            'class' => RelationFollowBehavior::className(),
            'relations' => [
                'books', // relation name
            ]
        ],
    ];
}

public function getBooks()
{
    return $this->hasMany(BookModel::className(), ['id' => 'book_id'])->via('authorBooks');
}

public function getAuthorBooks()
{
    return $this->hasMany(AuthorBooks::className(), ['author_id' => 'id']);
}
...

in my-view/_form.php

Select multiple from relation model. Recommended use yii2-widget-checkbox-multiple, (*5)

The Versions

23/02 2015

dev-master

9999999-dev https://github.com/diiimonn/yii2-behavior-relation-follow

  Sources   Download

by Dmitriy Gavrilenko

extension yii2 behavior relation

23/02 2015

v1.0.0

1.0.0.0 https://github.com/diiimonn/yii2-behavior-relation-follow

  Sources   Download

by Dmitriy Gavrilenko

extension yii2 behavior relation