Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Created February 2, 2015 16:32
Show Gist options
  • Select an option

  • Save shmaltorhbooks/2fd89cbd5c9996b1130b to your computer and use it in GitHub Desktop.

Select an option

Save shmaltorhbooks/2fd89cbd5c9996b1130b to your computer and use it in GitHub Desktop.
define symfony routing as service in symfony DI-container
parameters:
routing.file: 'routing_%core.name%.yml'
routing.cache:
debug: %core.debug%
cache_dir: '%core.cache_path%/routing/'
generator_cache_class: '%core.name%UrlGenerator%core.env%'
matcher_cache_class: '%core.name%UrlMatcher%core.env%'
services:
routing.file_locator:
public: false
class: Symfony\Component\Config\FileLocator
arguments:
- [%core.root_dir%]
routing.file_loader:
public: false
class: Symfony\Component\Routing\Loader\YamlFileLoader
arguments:
- @routing.file_locator
routing.request:
public: false
class: Symfony\Component\HttpFoundation\Request
factory: [@request_stack, 'getCurrentRequest']
routing.request_context:
public: false
class: Symfony\Component\Routing\RequestContext
calls:
- [ fromRequest, [@routing.request] ]
router:
class: Symfony\Component\Routing\Router
arguments:
- @routing.file_loader
- %routing.file%
- %routing.cache%
- @routing.request_context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment