Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Router service is now private#8985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Closed
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
The router service is private and not accessible in Symfony 4+, therefor $this->router should be used instead of $this->get('router'). Just above the example in question is explained how to get the router in your construct, so this should be clear.ContributorAuthor
TheDevilOnLine commentedJan 5, 2018
Will move these changes over to#8986 |
TheDevilOnLine pushed a commit to TheDevilOnLine/symfony-docs that referenced this pull requestJan 5, 2018
…jection over Container. Includes changes from PRsymfony#8985
javiereguiluz added a commit that referenced this pull requestJan 7, 2018
… javiereguiluz)This PR was merged into the 4.0 branch.Discussion----------Removed invalid examplesTemplating isn't a service in Symfony 4+ (even after `composer req templating`), so probably we're looking for the twig service.The Router service isn't public and can therefor not be called from the container:```$ php bin/console debug:container router // This service is an alias for the service router.defaultInformation for Service "router.default"======================================== ---------------- ----------------------------------------------- Option Value ---------------- ----------------------------------------------- Service ID router.default Class Symfony\Bundle\FrameworkBundle\Routing\Router Tags - Calls setConfigCacheFactory Public no Synthetic no Lazy no Shared yes Abstract no Autowired no Autoconfigured no ---------------- -----------------------------------------------```Commits-------3492028 Use controller method injection instead of the constructorf9091b0 Updated documentation to reflect best practice of using Dependency Injection over Container. Includes changes from PR#898518e6d9e Removed "Accessing the Container Directly"89e38ef Removed invalid examples
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull requestJan 7, 2018
* 4.0: Update collection.rst Mention that PSR-1 doesn't recommend CamelCase or anything else Fixed the XML and PHP config instead of the YAML config Use controller method injection instead of the constructor Add missing references Updated documentation to reflect best practice of using Dependency Injection over Container. Includes changes from PRsymfony#8985 Removed "Accessing the Container Directly" minorsymfony#8091 Update js-datepicker usage for new jQuery UI (AdrianBorodziuk, javiereguiluz) minorsymfony#8983 cross-reference console command testing from testing guide (dbu) Fix YAML config bug Removed invalid examples commands are automatically registered in symfony full stack update forms.rst
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The router service is private and not accessible in Symfony 4+, therefor $this->router should be used instead of $this->get('router'). Just above the example in question is explained how to get the router in your construct, so this should be clear.