/** * @param Attribute $attribute */ public function setAttribute(Attribute $attribute) { $this->attribute->removeValue($this); // Remove value from current attribute $attribute->addValue($this); // Add value to new attribute $this->attribute = $attribute; }
public function __construct(Attribute $attribute, string $name) { $this->name = $name; $this->attribute = $attribute; $attribute->addValue($this); }