Beispiel #1
0
 protected function discoveryByController($routes)
 {
     $defaultRoute = $this->getDefaultRoute();
     $module = $this->camelCase(isset($routes[0]) ? Url::removeSufix($routes[0]) : $defaultRoute['module']);
     $class_name = $this->camelCase(isset($routes[1]) ? Url::removeSufix($routes[1]) : $defaultRoute['controller']);
     $controller = $this->getControllerName($class_name, $module);
     if (class_exists($controller)) {
         $this->setModule($module);
         $this->setController($controller);
     }
 }
 protected function discoveryEntityChildren()
 {
     $routes = $this->getUrl();
     $count = count($routes);
     if ($count % 2 != 0 && $count > 0) {
         $index = $count - 1;
         $this->setEntityChildren(Url::removeSufix($routes[$index]));
         $routes = $this->removeClassFromUrl($routes, null, $index);
         $this->setUrl($routes);
     }
 }
Beispiel #3
0
 public function init(\Zend\ModuleManager\ModuleManager $mm)
 {
     $sharedManager = $mm->getEventManager()->getSharedManager();
     $sharedManager->attach(get_class($mm), ModuleEvent::EVENT_LOAD_MODULES_POST, new Listener\ModuleLoaderListener(), 9000);
     $config = $this->getDefaultConfig($this->config);
     $uri = array_values(array_filter(explode('/', $_SERVER['REQUEST_URI'])));
     if (isset($uri[0]) && isset($uri[1])) {
         $class = '\\' . ucfirst(Url::removeSufix($uri[0])) . '\\Controller\\' . ucfirst(Url::removeSufix($uri[1])) . 'Controller';
         $defaultClass = '\\' . ucfirst(Url::removeSufix($uri[0])) . '\\Controller\\' . $config['DefaultController'] . 'Controller';
         $this->module = ucfirst(Url::removeSufix($uri[0]));
         $this->controller = class_exists($class) ? $class : $defaultClass;
     } elseif (isset($uri[0])) {
         $controller = $config['DefaultController'];
         $class = '\\' . ucfirst(Url::removeSufix($uri[0])) . '\\Controller\\' . $controller . 'Controller';
         $this->module = ucfirst(Url::removeSufix($uri[0]));
         $this->controller = $class;
     } else {
         $module = $config['DefaultModule'];
         $controller = $config['DefaultController'];
         $class = '\\' . $module . '\\Controller\\' . $controller . 'Controller';
         $this->module = $module;
         $this->controller = $class;
     }
 }