8000 Be consistent in code examples by OskarStark · Pull Request #18050 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Be consistent in code examples #18050

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Be consistent in code examples
  • Loading branch information
OskarStark committed May 11, 2023
commit 2426ce44af403fde87d4989d2824c0f8d8e11bdf
8 changes: 8 additions & 0 deletions service_container/service_closures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ argument of type ``service_closure` 8000 `:
App\Service\MyService:
arguments: [!service_closure '@mailer']

# In case the dependency is optional
# arguments: [!service_closure '@?mailer']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this works actually

Copy link
Contributor
@alamirault alamirault May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked and it's ok, if mailer service doesn't exist, null is pass instead


.. code-block:: xml

<!-- config/services.xml -->
5CD4 Expand All @@ -69,6 +72,11 @@ argument of type ``service_closure``:
<services>
<service id="App\Service\MyService">
<argument type="service_closure" id="mailer"/>

<!--
In case the dependency is optional
<argument type="service_closure" id="mailer" on-invalid="ignore"/>
-->
</service>
</services>
</container>
Expand Down
0