Skip to content

Add documentation for using expressions as service factories #16516

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 1, 2022

Conversation

jvasseur
Copy link
Contributor

@jvasseur jvasseur commented Feb 16, 2022

@carsonbot carsonbot added this to the 6.1 milestone Feb 16, 2022
@jvasseur jvasseur changed the title Add document for using expressions as service factories Add documentation for using expressions as service factories Feb 16, 2022
@javiereguiluz
Copy link
Member

Closing because the related code PR (symfony/symfony#45447) was closed without merging.

@jvasseur
Copy link
Contributor Author

The code PR was replaced by symfony/symfony#45512 which is still opened so this PR could still be relevant.

@xabbuh xabbuh reopened this Mar 24, 2022
@xabbuh xabbuh modified the milestones: 6.1, next Mar 24, 2022
@xabbuh xabbuh added the Waiting Code Merge Docs for features pending to be merged label Mar 24, 2022
@nicolas-grekas
Copy link
Member

Code PR has been merged, time to finish this one!

@@ -125,3 +125,44 @@ via a ``container`` variable. Here's another example:

Expressions can be used in ``arguments``, ``properties``, as arguments with
``configurator`` and as arguments to ``calls`` (method calls).

You can also use expressions as factories to create services based on an expression:
Copy link
Member

Choose a reason for hiding this comment

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

What about shortening this to You can also use expressions as service factories:

@nicolas-grekas
Copy link
Member

We should also tell about the args/arg() var/function btw.

@OskarStark OskarStark removed the Waiting Code Merge Docs for features pending to be merged label Mar 28, 2022
@jvasseur
Copy link
Contributor Author

I've update the PR to mention the arg function and add the versionadded block.

@wouterj wouterj merged commit 2b58adb into symfony:6.1 May 1, 2022
@wouterj
Copy link
Member

wouterj commented May 1, 2022

Thank you @jvasseur! It's great to retrieve a doc PR for a new code feature :)

Fyi, after the merge I've moved the section to the factories article (and changed the example a bit) in 154d667

@jvasseur jvasseur deleted the expr-factory branch May 2, 2022 12:12
@jvasseur
Copy link
Contributor Author

jvasseur commented May 2, 2022

@wouterj thanks for merging, the updated examples looks really good with the associated explanations.

@wkania
Copy link
Contributor

wkania commented May 3, 2022

@wouterj 154d667 introduced a bug

Found invalid reference "/service_container/expressions" in file       
"service_container/factories"  

Job "Build the docs" is now broken.

@xabbuh
Copy link
Member

xabbuh commented Jun 9, 2022

FTR, that was fixed in da91570.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants