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']] ]; }