Beispiel #1
0
 /**
  * Constructor.
  *
  * @param ContainerInterface $container
  * @param AbstractModule $bundle
  */
 public function __construct(ContainerInterface $container, AbstractModule $bundle)
 {
     $this->container = $container;
     $this->entityManager = $container->get('doctrine.entitymanager');
     $this->name = $bundle->getName();
     $this->view = Zikula_View::getInstance($this->name);
     parent::__construct(ZLanguage::getModuleDomain($this->name));
 }
Beispiel #2
0
 /**
  * Load routes of the specified module from the module's configuration file.
  *
  * @param AbstractModule $module
  *
  * @return RouteCollection
  */
 public function find(AbstractModule $module)
 {
     try {
         $path = $this->kernel->locateResource($module->getRoutingConfig());
     } catch (\InvalidArgumentException $e) {
         // Routing file does not exist (e.g. because the bundle could not be located)
         return new RouteCollection();
     }
     $modname = $module->getName();
     $this->logger->info('Loading routes for ' . $modname);
     return $this->loader->import($path);
 }
Beispiel #3
0
 /**
  * @param AbstractModule $module
  * @param bool $userRoutes
  * @return bool
  */
 public function removeAllOfModule(AbstractModule $module, $userRoutes = false)
 {
     $routes = $this->findBy(array('userRoute' => $userRoutes, 'bundle' => $module->getName()));
     if (empty($routes)) {
         return false;
     }
     $workflowHelper = new WorkflowUtil(\ServiceUtil::getManager(), \ModUtil::getModule('ZikulaRoutesModule'));
     foreach ($routes as $routeEntity) {
         $workflowHelper->executeAction($routeEntity, 'delete');
     }
     return true;
 }