public function toArray() { $tree = $this->getTree(); return array_merge(parent::toArray(), ['items' => $tree, 'entity' => 'menu', 'itemCount' => $tree->size()]); }