69676[TASK] Avoid ObjectManager in ext:extbase
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Jochen Roth +1
- Benni Mack +1
-
Verified V +2 Done
- Christian Kuhn +2
- Jochen Roth +1
- Benni Mack +1
- core-ci +1 CI
Issues 3
Files 25
- typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php3+10 −10
- typo3/sysext/extbase/Classes/Mvc/Controller/ControllerContext.php+4 −5
- typo3/sysext/extbase/Classes/Mvc/View/GenericViewResolver.php4+14 −7
- typo3/sysext/extbase/Classes/Mvc/Dispatcher.php+1 −0
- typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php+10 −46
- typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php+6 −28
- typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php+7 −28
- typo3/sysext/extbase/Classes/Persistence/Generic/Query.php8+35 −60
- typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php5+22 −28
- typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php+19 −54
- typo3/sysext/extbase/Classes/Persistence/ForwardCompatibleQueryInterface.phpnew+27 −0
- typo3/sysext/extbase/Classes/Persistence/ForwardCompatibleQueryResultInterface.phpnew+27 −0
- typo3/sysext/extbase/Classes/Persistence/QueryInterface.php+7 −0
- typo3/sysext/extbase/Classes/Persistence/QueryResultInterface.php+5 −0
- typo3/sysext/extbase/Classes/Property/TypeConverter/AbstractFileFolderConverter.php+2 −1
- typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php5+18 −0
- typo3/sysext/extbase/Classes/Property/PropertyMapper.php3+17 −26
- typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php+1 −0
- typo3/sysext/extbase/Configuration/Services.yaml+11 −4
- typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php+8 −1
Show 5 more files
- typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryFactoryTest.php+13 −11
- typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryResultTest.php+19 −14
- typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php+11 −13
- typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php+1 −1
- typo3/sysext/extbase/Tests/Unit/Validation/Validator/CollectionValidatorTest.php+3 −1
Review log 1929
Show 24 earlier messages
-
Christian Kuhn uploaded patch set 1 06/30/21, 18:28
-
Christian Kuhn uploaded patch set 2 06/30/21, 18:29
-
core-ci voted on patch set 1 V -1 06/30/21, 18:30 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12868
-
core-ci voted on patch set 2 V -1 06/30/21, 18:31 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12869
-
Christian Kuhn uploaded patch set 3 06/30/21, 19:11
-
core-ci voted on patch set 3 V -1 06/30/21, 19:23 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12870
-
Christian Kuhn uploaded patch set 4 06/30/21, 20:45
-
core-ci voted on patch set 4 V -1 06/30/21, 20:56 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12875
-
Christian Kuhn uploaded patch set 5 06/30/21, 21:59
-
core-ci voted on patch set 5 V +1 06/30/21, 22:10 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12877
-
Christian Kuhn updated the commit message in patch set 6 06/30/21, 22:41
-
Christian Kuhn updated the commit message in patch set 7 06/30/21, 22:43
-
core-ci voted on patch set 6 V +1 06/30/21, 22:54 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12878
-
core-ci voted on patch set 7 V +1 06/30/21, 22:56 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12879
-
Christian Kuhn rebased onto patch set 8 06/30/21, 23:13
-
core-ci voted on patch set 8 V +1 06/30/21, 23:22 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12880
-
Benjamin Franzke commented on patch set 8 CR -1 07/09/21, 11:09
GenericViewResolver.php:38Why not inject right now? Does that result in technical problems?Query.php:124Again here, I'd like to inject right now as well.Query.php:240return here looks wrong, did you mean to return after the if-condition?Query.php:243Hm, when is this codepath triggered? QueryResultInterface will always be available in the container, no? Only case I can think of is installtool context where I guess this is never used.. I think we could remove the $this->container->has(QueryResultInterface::class) chekc above.QueryFactory.php:44Sorry, to repeat myself, but would already try to inject right now.QueryFactory.php:55Should always be true, drop else block?PropertyMapper.php:82This seems to be breaking, existing type converters may not be public symfony services. I think we need the occasonal `container->has ? container->get : objectManager->get` dance here.ObjectConverter.php:68Why nullable? Should always be injected…ObjectConverter.php:256Hm, so we only have a plan for objects without constructor arguments. These objects are not services, but rather data objects, so it's not really straight forward for our users to enable those data object as public services, especially if they are (proper) plain object. I think we should rather expect object that ObjectConverter targets to *avoid* injection and rather to be plain objects. What I'm saying: Should we maybe ask objectmananger in v11 whether the object asks for dependency injection and then provide it (plus deprecation logging), and otherwise use GeneralUtility::makeInstance. -
Benjamin Franzke uploaded patch set 9 07/09/21, 11:21
-
Benjamin Franzke commented on patch set 9 07/09/21, 11:21
GenericViewResolver.php:38ReplyDoneQuery.php:124ReplyDoneQuery.php:240ReplyNevermind, I see why you did it, alright. of course we can only use the object if we're able to set the query.QueryFactory.php:44ReplyDoneObjectConverter.php:68ReplyDone -
Benjamin Franzke commented on patch set 9 07/09/21, 11:25
Agree with the patch in general,Query.php:243ReplyNevermind, I see, when QueryResultInterface is aliased to a custom service that doesn't implement ForwardCompatibleQueryResultInterface. -
core-ci voted on patch set 9 V -1 07/09/21, 11:31 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13136
-
Christian Kuhn commented on patch set 9 07/10/21, 09:42
ActionController.php:403ReplySee https://review.typo3.org/c/Packages/TYPO3.CMS/+/65646 - Alex declared this for validators in general at a different point already in v11.0. This change here is just a follow-up picking up another place which https://review.typo3.org/c/Packages/TYPO3.CMS/+/65646 didn't catch. Imho fine.GenericViewResolver.php:38ReplyI run into trouble at places where ObjectManager->get() instantiated these classes, since OM has no 'alias' for ContainerInterface and the service injection of container then failed. This happened in particular with the styleguide backend module - styleguide has no Services.yaml, yet and the backend controller extends extbase backendController. I saw your change to register ContainerInterface / container recently (OM receives all aliases in a compilerPass loop), so maybe your change fixed that, but I did not re-test again. But the "OM can't inject containerInerface thing was the reason i used getContainer()" in a couple of places.Query.php:124Replysee my other comment, do that only if it works with OM.QueryFactory.php:55ReplyAdded this in case anyone registered a different alias. But yeah, compiling should fail if that alias isn't available. So yeah, that if seems obsolete and should be possible to drop together with else.PropertyMapper.php:82Replyok. yeah. should be easily do-able, too.ObjectConverter.php:256ReplyI wasn't sure here and picked the straight path saying 'no manual constructor arguments for these mapped objects'. The typical use-case for the ObjectConverter is if a form is mapped to some object (like "demand" in beuser). Those have the typical get/set methods. People don't seem to know that properties could be hand over as __construct arguments, extbase then finds them and maps them if the argument name matches. I'd thus argue this is a rather unknown, pretty ugly, and highly magic-driven feature and tried to drop that rather silently ^^ Now that you point it out, I still think we could do that, but not 100% sure anymore. Maybe Alex could also state his opinion on this topic? My point is: everyone use inject* stuff in extbase everywhere and not many people use stuff like this special construct argument mapping ... i'd thus rather drop the latter. -
Christian Kuhn commented on patch set 9 07/21/21, 16:07
ActionController.php:403ReplyDoneGenericViewResolver.php:38ReplyQuery.php:124ReplyQueryFactory.php:55ReplyDonePropertyMapper.php:82ReplyDoneObjectConverter.php:256Replywill keep solution as is. -
Christian Kuhn uploaded patch set 10 07/21/21, 16:07
-
core-ci voted on patch set 10 V +1 07/21/21, 16:19 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13634
-
Benni Mack voted on patch set 10 V +1 CR +1 07/22/21, 13:45
-
Jochen Roth voted on patch set 10 V +1 CR +1 07/22/21, 14:43
-
Christian Kuhn voted on patch set 10 V +2 CR +2 07/22/21, 14:53
-
Christian Kuhn merged patch set 11 07/22/21, 14:54
ActionController.php:403