0
votes

I have a composer based TYPO3 7.6 installation and want to create an Extbase extension with a command controller.

The controller is registered in ext_localconf.php but the commmand controller isn't found because the class is not found in typo3/sysext/extbase/Classes/Mvc/Cli/CommandManager.php in public function getAvailableCommands()

Namespace is also set: namespace Foo\FooT3monitoringNotification\Command;
The class is here Classes/Command/NotificationCommandController.php.

I've cleared all TYPO3 caches and did composer dump-autoload. Any idea, what I missed to do or what I can do to find out, why my class isn't put to autoload?

1
Have a look in the generated autoload_* in your composer directory - you should find your namespace there. Additionally: is it a composer based installation (I guess so ;)) or a "classic"?Susi
Yes, it's cmposer based. And there is nothing about my class in any of the files in vendor/composer/autoload_. What might prevent my class being added there? Do I need a composer.json in my extension?Peter Kraume
Do you have an public actionCommand in the Controller? Something like public doMyTaskCommand()?René Pflamm
Yes! For testing purposes I have public function simpleCommand() there.Peter Kraume

1 Answers

5
votes

As your newly created extension is not installed via composer, you need to define where to look for the classes. Therefore you need to add an autoload section to your root composer.json (that' means not in your extension, but in your TYPO3 distribution root folder):

"autoload": {
    "psr-4": {
        "Foo\\FooT3monitoringNotification\\": "web/typo3conf/ext/foo_t3monitoring_notification/Classes"
    }
}

More information: https://usetypo3.com/typo3-and-composer.html#c67