symfony / symfony-docs

The Symfony documentation
https://symfony.com/doc
Other
2.17k stars 5.12k forks source link

Symfony3 doc Service container example #5999

Closed bigs21 closed 8 years ago

bigs21 commented 8 years ago

In the documentation, at http://symfony.com/doc/3.0/book/service_container.html#creating-configuring-services-in-the-container the file to edit is not correct.

It points to config.yml:

# app/config/config.yml
services:
    my_mailer:
        class:        Acme\HelloBundle\Mailer
        arguments:    [sendmail]

But should be services.yml:

# app/config/services.yml
services:
    my_mailer:
        class:        Acme\HelloBundle\Mailer
        arguments:    [sendmail]

The same may be the case for XML and PHP formats.

wouterj commented 8 years ago

Please note that it's possible to do it in both files, but services.yml definitely is more correct.

If you want, you can submit a fix for this yourself by clicking on the blue "edit" button of the page and changing the file names.

xabbuh commented 8 years ago

Good catch @bigs21. We can also update the example to use the AppBundle namespace. Do you like to work on a pull request?

bigs21 commented 8 years ago

Not at the moment, @WouterJ and @xabbuh. I'll leave it to the pros.

Or at least someone that has done at least 1 line of code in Symfony3.