From f1aea759539567a23b7e4897b6cef4df6200c3fc Mon Sep 17 00:00:00 2001 From: Alban Jubert Date: Fri, 3 Nov 2017 10:35:34 +0100 Subject: [PATCH] Preparation of version 1.3.2 --- CHANGELOG.md | 4 ++++ tests/models/UserProfile.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54546ec..0788da0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/tests/models/UserProfile.php b/tests/models/UserProfile.php index 5d9c6d6..22a8bb2 100644 --- a/tests/models/UserProfile.php +++ b/tests/models/UserProfile.php @@ -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']] ]; }