mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-29 03:00:15 +02:00
Merge pull request #187 from ftwbzhao/feature/eav
[EAV] Value::setAttribute add return this
This commit is contained in:
@@ -28,12 +28,15 @@ class Value implements ValueInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Attribute $attribute
|
* @param Attribute $attribute
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setAttribute(Attribute $attribute)
|
public function setAttribute(Attribute $attribute)
|
||||||
{
|
{
|
||||||
$this->attribute->removeValue($this); // Remove value from current attribute
|
$this->attribute->removeValue($this); // Remove value from current attribute
|
||||||
$attribute->addValue($this); // Add value to new attribute
|
$attribute->addValue($this); // Add value to new attribute
|
||||||
$this->attribute = $attribute;
|
$this->attribute = $attribute;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user