Created
March 30, 2012 11:21
-
-
Save peterjmit/2250882 to your computer and use it in GitHub Desktop.
Global Symfony 2 Config without Config Parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/config/config_dev.yml | |
| imports: | |
| - { resource: config.yml } | |
| framework: | |
| # ... | |
| web_profiler: | |
| # ... | |
| monolog: | |
| # ... | |
| assetic: | |
| # ... | |
| services: | |
| # ... | |
| parameters: | |
| test.foo_array: | |
| - { bar: value } | |
| - { baz: value } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # src/Vendor/SomeBundle/Resources/config/services.yml | |
| parameters: | |
| # ... | |
| services: | |
| some_service: | |
| # ... | |
| arguments: [ %test.foo_array% ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // src/Vendor/SomeBundle/Controller/SomeController.php | |
| namespace Vendor\SomeBundle\Controller; | |
| use Symfony\Bundle\FrameworkBundle\Controller\Controller, | |
| Symfony\Component\HttpFoundation\Request; | |
| class SomeController extends Controller | |
| { | |
| public function fooAction() | |
| { | |
| $configArray = $this->container->getParameter('test.foo_array'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment