Retrieve a route by instance identifier
public findByInstanceId ( string $instanceId ) : |
||
$instanceId | string | instance identifier |
return |
/** * Retrieve a route by instance identifier * * @param string $instanceId instance identifier * @return InstanceRoute */ public function findByInstanceId($instanceId) { if (!array_key_exists($instanceId, $this->mapByInstanceId)) { if (!($route = $this->repo->findByInstanceId($instanceId))) { return null; } $this->setToMap($route); } return $this->mapByInstanceId[$instanceId]; }
/** * getHomeInstanceRoute * * @return InstanceRoute */ private function getHomeInstanceRoute() { if (static::$homeInstanceRoute === null) { $homeInstanceId = $this->siteHandler->getHomeInstanceId(); $instanceRoute = $this->routeRepo->findByInstanceId($homeInstanceId); static::$homeInstanceRoute = $instanceRoute; return $instanceRoute; } else { return static::$homeInstanceRoute; } }
/** * Retrieve a route by instance identifier * * @param string $instanceId instance identifier * @return InstanceRoute|null */ public function findByInstanceId($instanceId) { $key = $this->getCacheKey($instanceId); $route = $this->cache->has($key) ? $this->cache->get($key) : call_user_func(function () use($instanceId) { if ($route = $this->repo->findByInstanceId($instanceId)) { $this->cachingItem($route); } return $route; }); return $route; }
/** * Destroy menu type associated with the menu item. * * @param MenuItem $item menu item instance * @return void */ protected function destroyMenuType(MenuItem $item) { $menuTypeObj = $this->modules->getModuleObject($item->type); $menuTypeObj->deleteMenu($item->getKey()); if ($menuTypeObj::isRouteAble()) { $instanceRoute = $this->routes->findByInstanceId($item->getKey()); $this->routes->delete($instanceRoute); } }