@ -1,5 +1,9 @@
# Yii2 Active Record Save Relations Behavior Change Log
## [1.3.2]
### Fixed
- Bug #22: Fix for HasOne relation pointing to the owner primary key (thx @mythicallage)
## [1.3.1]
### Added
- Enh #19: Support for defining relations through the `getRelation` method (thx @execut)
@ -18,7 +18,10 @@ class UserProfile extends \yii\db\ActiveRecord
public function rules()
{
return [
['bio', 'required']
[['user_id'], 'integer'],
['bio', 'required'],
[['user_id'], 'unique'],
[['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']]
];
}