dispatcher = $dispatcher; $this->factory = $factory; } public function userTopbar(RequestStack $request): ItemInterface { $menu = $this->factory->createItem('root'); $this->dispatcher->dispatch( UserMenuEvent::EVENT, new UserMenuEvent($this->factory, $menu, $request) ); return $menu; } }