Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Removed invalid examples#8986

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

Merged
javiereguiluz merged 4 commits intosymfony:4.0fromTheDevilOnLine:patch-2
Jan 7, 2018
Merged

Conversation

@TheDevilOnLine
Copy link
Contributor

Templating isn't a service in Symfony 4+ (even aftercomposer 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 ---------------- -----------------------------------------------

Templating 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:```Information 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 ---------------- -----------------------------------------------```
@javiereguiluz
Copy link
Member

Maybe it's time to remove theAccessing the Container Directly section entirely.@weaverryan what do you think?

@weaverryan
Copy link
Member

Yea, I agree: we should remove this section entirely. Could you do that@TheDevilOnLine?

Removed "Accessing the Container Directly" section, as this way of work is currently deprecated.
@TheDevilOnLine
Copy link
ContributorAuthor

TheDevilOnLine commentedJan 5, 2018
edited
Loading

@weaverryan Done. Can you guys do the squashing when doing the merge?

Want me to check the rest of the documentation for these kind of container usage as well?

@weaverryan
Copy link
Member

@TheDevilOnLine Yep, no worries - we'll handle the squashing.

Want me to check the rest of the documentation for these kind of container usage as well?

YES! I was literallyjust thinking this as I opened up your PR. There probably are a few legit cases still, but yea, we need to check all the docs to be sure.

Thanks!

@TheDevilOnLine
Copy link
ContributorAuthor

TheDevilOnLine commentedJan 5, 2018
edited
Loading

I've went over the documentation and checked all instances containing$this->get() or$this->container->get() and added changes for the places where it makes sense. All remaining instances only show 'the old way', or explain about public/private services.

The only thing I didn't know for sure (which might improve the documentation), is if there's a way to get a Doctrine EntityManager, other than the default one, through dependency injection. If this is possible, I think it's a good idea to add this information to multiple_entity_managers.rst as well

I think the only other way is to inject the complete doctrine service, and callgetManager('customer') on it, but I don't feel this is better than$this->getDoctrine()->getManager('customer'), do you? Also including documentation about defining it in the service,yml (like below, thanks@chasen for the example) seems like to much for this specific part in the documentation.

App\Service\SomeService:    arguments:        $doctrine: "@doctrine.orm.manager_name"

@javiereguiluz
Copy link
Member

@TheDevilOnLine thanks for updating all this and congrats on your first contribution to Symfony Docs!

@javiereguiluzjaviereguiluz merged commit3492028 intosymfony:4.0Jan 7, 2018
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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@TheDevilOnLine@javiereguiluz@weaverryan@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp