diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php index 4f06ccc..12b9289 100644 --- a/Controller/DefaultController.php +++ b/Controller/DefaultController.php @@ -21,7 +21,7 @@ public function indexAction($url) Zend_Registry::set('dic', $this->container); $rootDir = $this->get('kernel')->getRootDir(); - $bootstrap = $this->container->getParameter('zf1wrapper_bootstrap_path'); + $bootstrap = $this->container->getParameter('bootstrap_path'); // capture content from legacy application ob_start(); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index dac9ece..2eb57a8 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -20,9 +20,14 @@ public function getConfigTreeBuilder() $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('zf1_wrapper'); - // Here you should define the parameters that are allowed to - // configure your bundle. See the documentation linked above for - // more information on that topic. + $rootNode + ->children() + ->scalarNode('bootstrap_path') + ->info('Relative path to Zend Framework Bootstrap file kernel.root_dir') + ->isRequired() + ->cannotBeEmpty() + ->end() + ->end(); return $treeBuilder; } diff --git a/DependencyInjection/Zf1WrapperExtension.php b/DependencyInjection/Zf1WrapperExtension.php index a01dcca..c2b0f9b 100644 --- a/DependencyInjection/Zf1WrapperExtension.php +++ b/DependencyInjection/Zf1WrapperExtension.php @@ -22,6 +22,8 @@ public function load(array $configs, ContainerBuilder $container) $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); + $container->setParameter('bootstrap_path', $config['bootstrap_path']); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); } diff --git a/README.md b/README.md index cb47233..960c0ce 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,10 @@ Add the following to your composer.json: ### 1. config.yml ### You need to configure is the location of your ZF1 bootstrap file (e.g. index.php). -Add the following to your config.yml: +Add the following to your packages/zf1_wrapper.yml: ``` -parameters: - - #Zf1WrapperBundle - zf1wrapper_bootstrap_path: ../web/index.php +zf1_wrapper: + bootstrap_path: ../web/index.php ``` ### 2. routing.yml diff --git a/Resources/config/parameters.yml b/Resources/config/parameters.yml index 7d9f13b..cb11cf9 100644 --- a/Resources/config/parameters.yml +++ b/Resources/config/parameters.yml @@ -1,2 +1,2 @@ parameters: - zf1wrapper_bootstrap_path: ../web/index.php # your ZF1 bootstrap file relative to kernel.root_dir + bootstrap_path: ../web/index.php # your ZF1 bootstrap file relative to kernel.root_dir