Skip to content

[DependencyInjection] Add #[Lazy] attribute #19506

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
Mar 21, 2024

Conversation

Tiriel
Copy link
Contributor

@Tiriel Tiriel commented Feb 5, 2024

Fixes #19486
Documentation for the new #[Lazy] attribute.

@carsonbot carsonbot added this to the 7.1 milestone Feb 5, 2024
@OskarStark OskarStark changed the title [DependencyInjection] Add Lazy attribute documentation [DependencyInjection] Add #[Lazy] attribute Feb 5, 2024
// ...
}

This attribute can be used on a class or on a parameter which should be lazy-loaded, and has a ``lazy`` parameter
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this part:

and has a ``lazy`` parameter that also supports defining interfaces to proxy and intersection types::

What's the purpose of the lazy option? (which, by the way, looks like a bad option name to me because the attribute is also called lazy)_. Is "type intersection" related to lazy option in any way? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a compatibility issue, because the same param exists in both #[Autoconfigure] and #[Autowire], and that way the parameter handling is the same.

I admit I'm not sure how to phrase this. But since this is the only parameter, maybe the name can be dropped in the example? Like:
and has a parameter that also supports defining interfaces to proxy and intersection types::

@Tiriel
Copy link
Contributor Author

Tiriel commented Mar 11, 2024

Upping this PR. I made modifications, is there anything else I can do to improve it? @javiereguiluz @alexandre-daubois

@javiereguiluz javiereguiluz merged commit d1052b2 into symfony:7.1 Mar 21, 2024
@javiereguiluz
Copy link
Member

Thanks Benjamin! This is now merged.

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.

[DependencyInjection] Add Lazy attribute for classes and arguments
5 participants