You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
848 B
48 lines
848 B
8 years ago
|
<?php
|
||
|
/**
|
||
|
* @link http://www.lahautesociete.com
|
||
|
* @copyright Copyright (c) 2016 La Haute Société
|
||
|
*/
|
||
|
|
||
|
namespace tests\models;
|
||
|
|
||
|
use lhs\Yii2SaveRelationsBehavior\SaveRelationsBehavior;
|
||
|
|
||
|
/**
|
||
|
* DummyModel class
|
||
|
*
|
||
|
* @author albanjubert
|
||
|
**/
|
||
|
class DummyModel extends \yii\db\ActiveRecord
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public static function tableName()
|
||
|
{
|
||
|
return 'dummy';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function behaviors()
|
||
|
{
|
||
|
return [
|
||
|
'saveRelations' => [
|
||
|
'class' => SaveRelationsBehavior::className(),
|
||
|
'relations' => ['children']
|
||
|
],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return \yii\db\ActiveQuery
|
||
|
*/
|
||
|
public function getChildren()
|
||
|
{
|
||
|
return $this->hasOne(DummyModel::className(), ['id' => 'parent_id']);
|
||
|
}
|
||
|
|
||
|
}
|