I’m encountering an issue while upgrading my Typo3 extension from version 11 to version 12. Initially, I faced a problem where my Controller wasn’t being found. To address this, I created a Services.yaml file in my extension’s configuration, setting my Controllers and Repositories to public. This solved the issue, but then I encountered problems with dependency injection. I resolved those by using constructor injection and configuring the services in the Services.yaml file.
However, now I’m facing a new issue. I’m seeing the following error in my log file:
(1/1) Error
Call to a member function getClassSchema() on null
in /var/www/typo3/vendor/typo3/cms-extbase/Classes/Mvc/Controller/ActionController.php line 288
*/
protected function initializeActionMethodArguments(): void
{
$methodParameters = $this->reflectionService
->getClassSchema(static::class)
->getMethod($this->actionMethodName)->getParameters();
foreach ($methodParameters as $parameterName => $parameter) {
$dataType = null;
at TYPO3CMSExtbaseMvcControllerActionController->initializeActionMethodArguments()
in /var/www/typo3/vendor/typo3/cms-extbase/Classes/Mvc/Controller/ActionController.php line 381
$this->request = $request;
$this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$this->uriBuilder->setRequest($request);
$this->actionMethodName = $this->resolveActionMethodName();
$this->initializeActionMethodArguments();
$this->initializeActionMethodValidators();
$this->mvcPropertyMappingConfigurationService->initializePropertyMappingConfigurationFromRequest($request, $this->arguments);
$this->initializeAction();
$actionInitializationMethodName = 'initialize' . ucfirst($this->actionMethodName);
I’m quite confused and haven’t been able to find any relevant solutions online. If you need any additional information from my end, please let me know, and I’ll provide it as soon as possible.
I’ve already checked the following:
-
Services.yaml: I reviewed it for any typos or syntax issues, but everything appears to be correct.
-
Caches: I cleared all caches, thinking old data might be causing issues, but that didn’t resolve the problem.
-
Autoloading: I verified that autoloading is functioning correctly, so the class should be found.
-
Dependencies/Injections: I confirmed that all dependencies and injections are properly configured.
Thanks in advance for your assistance!
2
Answers
You should Look at the Backtrace. TYPO3 expects an Object to but has nothing (null)
so look at the backtrace which Class should Be instantiated. most likly this class no longer exits. because it has been removed or renamed.
the classname should also give you an idea if its part of the TYPO3 core or an extension. then you can lookup the corresponding migration steps.
I had this when my
Services.yaml
hadservices._defaults.autowire: false
set.When changing
autowire
totrue
, the controller could be loaded.