TYPO3CMS-Reference-CoreApi
TYPO3CMS-Reference-CoreApi copied to clipboard
WIPs on dependency injection page
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DependencyInjection/Index.html#wip-configuration
Update May 19, 2024:
- these is one WIP left:
Using container->get()
[WIP] Service containers provide two methods to obtain objects
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DependencyInjection/Index.html#using-container-get
There are several WIPs there (which are also written into the URL when you click on "Permalink for this headline"): Index.html#wip-configuration
Also, I am not sure if the WIP refers to the documentation or if this refers to something being WIP in the core (since we are the main branch). However, this would be surprising as the LTS for v12 was already released.
The WIPs are not very helpful (from my point of view of reader now!) because there is not a comment what is WIP and if something is not quite right.
- If the WIPs are only for people working in the documentation, can we use other methods such as issues, comments or
.. todo::? - If the WIPs should show that something is outdated, can we add a note? (and remove the WIP?)
- in any case, make sure it is not in the permalink
I revised the configuration section of the dependency injection chapter some time ago and removed the WIP for configuration (as it is comprehensive like it is now): https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/commit/836049b066650b569078395389854d2ce8d7e067
There are some other WIPs left.
There is still one WIP left: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DependencyInjection/Index.html#using-container-get
I would add a patch myself but I don't know what that refers to and how to fix it.
Some things I'd have questions as a reader and might be WIP right now:
- How to get to $container (makeInstance? DI again?)
- Anything you can not get from $container?
- Difference between container->get and makeInstance
- Some example code showing $container->get usage
- When could container->get be useful (functional testing probably, "uncached" mode, early bootstrapping, ...?)
I don't think we should encourage average users to use $container->get() in production code as this is a big anti-pattern. There might be helpful to use service locators, but that is DI advanced (this case is covered by Symfony docs) and I don't think we should (novice, intermediate) users encourage to use it (as this has also drawbacks). If someone has to use $container->get() there might be a major flaw in the user's code which should be solved instead.
$container->get() might be helpful in functional tests, but this should be covered by the testing chapter IMHO.
Agreed. I'm currently giving the DI chapter some love and will remove the general $container->get() hint at this point.