5 changed files with 128 additions and 9 deletions
			
			
		| @ -0,0 +1,48 @@ | ||||
| <?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 BadConfigurationModel 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']); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,25 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace tests\models; | ||||
| 
 | ||||
| class UserProfile extends \yii\db\ActiveRecord | ||||
| { | ||||
|     /** | ||||
|      * @inheritdoc | ||||
|      */ | ||||
|     public static function tableName() | ||||
|     { | ||||
|         return 'user_profile'; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @inheritdoc | ||||
|      */ | ||||
|     public function rules() | ||||
|     { | ||||
|         return [ | ||||
|             ['bio', 'required'] | ||||
|         ]; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
					Loading…
					
					
				
		Reference in new issue