/** * @param \Category $parent * @param bool $crossLinking */ public function setParent(Category $parent, $crossLinking = true) { if ($this->parent) { $this->parent->removeChild($this, false); } $this->parent = $parent; if ($crossLinking && $parent) { $parent->addChild($this, false); } }