/** * Create the ExtDirect API based on controllers files. * * @return string JSON description of Direct API */ protected function createApi() { $bundles = $this->getControllers(); $actions = array(); foreach ($bundles as $bundle => $controllers) { $bundleShortName = str_replace('Bundle', '', $bundle); foreach ($controllers as $controller) { $api = new ControllerApi($this->container, $controller); if ($api->isExposed()) { $actions[$bundleShortName . '_' . $api->getActionName()] = $api->getApi(); } } } return array('url' => $this->container->get('request')->getBaseUrl() . $this->container->getParameter('direct.api.route_pattern'), 'type' => $this->container->getParameter('direct.api.type'), 'namespace' => $this->container->getParameter('direct.api.namespace'), 'id' => $this->container->getParameter('direct.api.id'), 'actions' => $actions); }