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; 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); } /**