Conversation
97f9a54 to
63f066e
Compare
|
I don't really see the benefit of knowing if a object is lazy, if the container or a consumer needs to know it (what I'm not sure if it is needed) it could be achieved with a reflection and the What would be the use case for this implementation? |
|
About use case for this feature you can read here: joomla/joomla-cms#45062
We can achieve it by defining plugins as lazy. Also you can read about lazy services here: https://symfony.com/doc/current/service_container/lazy_services.html |
|
The |
|
To simplify the whole pr, I would only add a lazy function and then create an insteance of resource there. The rest can be reverted I guess as it complicates the whole thing. Also in the resource I would only add the really needed functions in a first implementation. If we need more along the way we can always add them when needed. |
|
But I like that you added unit tests to the pr. |
|
@laoneo, I've added the changes you requested. But I'm not sure if I got them right. |
|
That's exactly how I intended it. |
|
I made a more lightweight version in #63. Can you have a look if I missed something? |
|
Closed in favor of #63 |
Pull Request for Issue joomla/joomla-cms#45062
This PR add an ability to define lazy services using a new PHP 8.4 feature: https://www.php.net/manual/en/language.oop5.lazy-objects.php
Summary of Changes
A new shortcut method
lazy()was added:Testing Instructions
Unit tests are provided.
Documentation Changes Required
Yes.