From 5189a7342c5b513e5ff3415c94e02c85e77f4213 Mon Sep 17 00:00:00 2001 From: James LaChance Date: Sat, 17 Sep 2016 23:51:58 -0400 Subject: [PATCH 1/2] DRY things up a bit --- Structural/DataMapper/User.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Structural/DataMapper/User.php b/Structural/DataMapper/User.php index 8d8d2b2..f3f7661 100644 --- a/Structural/DataMapper/User.php +++ b/Structural/DataMapper/User.php @@ -33,9 +33,9 @@ class User */ public function __construct($id = null, $username = null, $email = null) { - $this->userId = $id; - $this->username = $username; - $this->email = $email; + $this->setUserID($id); + $this->setUsername($username); + $this->setEmail($email); } /** From 118c37adabd58e5774517957235f11f0db5de9d7 Mon Sep 17 00:00:00 2001 From: James LaChance Date: Sun, 18 Sep 2016 12:54:11 -0400 Subject: [PATCH 2/2] DRY more things! --- More/EAV/Value.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/More/EAV/Value.php b/More/EAV/Value.php index 2c156a9..da4370f 100644 --- a/More/EAV/Value.php +++ b/More/EAV/Value.php @@ -22,8 +22,7 @@ class Value implements ValueInterface */ public function __construct(Attribute $attribute) { - $attribute->addValue($this); - $this->attribute = $attribute; + $this->setAttribute($attribute); } /** @@ -33,7 +32,7 @@ class Value implements ValueInterface */ public function setAttribute(Attribute $attribute) { - $this->attribute->removeValue($this); // Remove value from current attribute + $this->attribute && $this->attribute->removeValue($this); // Remove value from current attribute $attribute->addValue($this); // Add value to new attribute $this->attribute = $attribute;