TYPO3-Documentation / TYPO3CMS-Reference-CoreApi

"TYPO3 Explained": Main TYPO3 Core Document: Main classes, Security, TypoScript syntax, Extension API and much more
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/
22 stars 396 forks source link

WIPs on dependency injection page #2339

Open sypets opened 2 years ago

sypets commented 2 years ago

https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DependencyInjection/Index.html#wip-configuration

Update May 19, 2024:

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.

brotkrueml commented 1 year ago

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.

sypets commented 6 months ago

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.

garvinhicking commented 6 months ago

Some things I'd have questions as a reader and might be WIP right now:

brotkrueml commented 6 months ago

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.