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