public function initUrls() { $router = OW::getRouter(); $urls = $this->urlDao->findAll(); /* @var $url OASEO_BOL_Url */ foreach ($urls as $url) { $rt = $router->getRoute($url->getRouteName()); if ($rt !== null) { $slugRoute = false; if (get_class($rt) == 'OASEO_CLASS_SlugRoute') { $origRt = $rt; $rt = $origRt->getRoute(); $slugRoute = true; } $rtArr = (array) $rt; $routeName = $rtArr["OW_RouterouteName"]; $routePath = $rtArr["OW_RouteroutePath"]; $routePathArray = $rtArr["OW_RouteroutePathArray"]; $isStatic = $rtArr["OW_RouteisStatic"]; $dispatchAttrs = $rtArr["OW_RoutedispatchAttrs"]; $routeParamOptions = $rtArr["OW_RouterouteParamOptions"]; $newRoute = new OW_Route($routeName, $url->getUrl(), $dispatchAttrs['controller'], $dispatchAttrs['action'], $routeParamOptions); if ($slugRoute === true) { $newRoute = new OASEO_CLASS_SlugRoute($newRoute, $origRt->getServiceCallback(), $origRt->getDtoProperty(), $origRt->getPathProperty(), $origRt->getEntityType()); } $router->removeRoute($url->getRouteName()); $router->addRoute($newRoute); $rand = uniqid('redirect_url'); $redirectRoute = new OASEO_CLASS_RedirectRoute($rand, $routePath, $rand, $rand); $redirectRoute->setNewUrl($url->getUrl()); $router->addRoute($redirectRoute); } } }