When Trying to register my DummyController to use it as a Typo3 Plugin, I get the following error:
ServiceNotFoundException: You have requested a non-existent service "MyVendorNameTypo3StarterSitepackageControllerDummyController"
I tried to do everything like the documentation states, and also did some research, bud was unable to resolve the issue. Here is my code:
My controller:
<?php
namespace MyVendorNameTypo3StarterSitepackageController;
use PsrHttpMessageResponseInterface;
class DummyController extends ActionController
{
public function dummyListAction(): ResponseInterface
{
return $this->htmlResponse();
}
}
My DummyRepository.php:
<?php
namespace MyVendorNameTypo3StarterSitepackageDomainRepository;
use TYPO3CMSExtbasePersistenceQueryInterface;
class DummyRepository extends Repository
{
// this already has some default functions, like findAll(), inherited from the Repository class.
}
My Services.yaml file:
services:
# general settings
_defaults:
autowire: true
autoconfigure: true
public: false
MyVendorNameTypo3StarterSitepackage:
resource: '../Classes/*'
My ext_localconf.php:
<?php
use MyVendorNameTypo3StarterSitepackageControllerDummyController;
use TYPO3CMSExtbaseUtilityExtensionUtility;
defined('TYPO3') or die('Access denied.');
/***************
* Add default RTE configuration
*/
// $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['typo3_starter_sitepackage'] = 'EXT:typo3_starter_sitepackage/Configuration/RTE/Default.yaml';
/***************
* PageTS
*/
TYPO3CMSCoreUtilityExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:typo3_starter_sitepackage/Configuration/TsConfig/Page/All.tsconfig">');
ExtensionUtility::configurePlugin(
'typo3_starter_sitepackage',
'DummyList',
[DummyController::class => 'dummyList'],
);
With this code I am able to select the Plugin through the Typo3 Backend, but then the ServiceNotFoundException is thrown. I am aware that the Controller doesn’t return anything right now, but I think that’s not the cause of this issue.
I am working on Windows using XAMPP with PHP 8.2, Typo3 12.4.10.
2
Answers
I was finally able to fix the issue. There were two main problems with my installation and honestly I want to partially blame TYPO3 quirks and insufficient documentation for it. Anyway, here is how I fixed it:
typo3cms install:fixfolderstructure
was called. This never worked for me, as this path is seemingly wrong for typo3 12. Instead I settypo3 cache:flush
andtypo3 cache:warmup
.After that, I deleted my composer.lock file and my vendor folder and freshly installed the composer packages (this might not have been necessary). The post autoload dump script, that now clears the typo3 caches, ran without errors and the ServiceNotFoundException went away.
Casual errors related to these cases are:
and try to rebuild caches