Skip to content

Commit 115dd3b

Browse files
committed
[EAV] Value::setAttribute add return this
1 parent 3bf84ae commit 115dd3b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

More/EAV/Tests/ValueTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function testSetGetAttribute()
4040
$value->setName('Silver');
4141
$this->assertSame($attribute, $value->getAttribute());
4242

43-
$value->setAttribute($attribute);
44-
$this->assertSame($attribute, $value->getAttribute());
43+
$this->assertSame($attribute, $value->setAttribute($attribute)->getAttribute());
4544
}
4645
}

More/EAV/Value.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ public function __construct(Attribute $attribute)
2828

2929
/**
3030
* @param Attribute $attribute
31+
* @return $this
3132
*/
3233
public function setAttribute(Attribute $attribute)
3334
{
3435
$this->attribute->removeValue($this); // Remove value from current attribute
3536
$attribute->addValue($this); // Add value to new attribute
3637
$this->attribute = $attribute;
38+
39+
return $this;
3740
}
3841

3942
/**

0 commit comments

Comments
 (0)