I - successfully - implemented a contact form based on Neos.Fusion.Form - SingleStepProcess. The standard “message” action and “log” action are working fine.
Now I’m trying to implement a custom action in PHP but fail at the very basics.
I took the class MessageAction from the Custom Form Actions docs and renamed it to class ExchangeWebServicesMailAction. But I don’t know / didn’t find the conventions for the class filename and path and if the class has to be configured somewhere to be known.
I placed it in DistributionPackages/MYCOMPANY.Site/Classes/Action/ExchangeWebServicesMailAction.php
Currently I get
An exception was thrown while Neos tried to render your page
The action handler “MYCOMPANY.Site:ExchangeWebServicesMail” was could not be resolved!
Where do I have to place the class file? Do I have to configure it somewhere? Does an action class need a fusion file?
Some help and enlightenment would be very appreciated
thanks for the hint. That was one necessary building block. After several days of tedious trial and error I found two further prerequisites: configure the classes path in the composer.json (which you also have in your project) and refresh the composer and flow system.
Correspondingly my class ExchangeWebServicesMailAction extends AbstractAction is in the file DistributionPackages\MYCOMPANY.Site\Classes\Action\ExchangeWebServicesMailAction.php .
refresh composer and flow by
composer dump-autoload
composer install
./flow neos.flow:cache:flush
sudo service apache2 restart
Not sure which of these are unavoidable but without them my changes did not become effective. I think dump-autoload and cache:flush are a must in this case.
The autoload part of composer is crucial, for the autoloader to know, what files to load for the application
The autoload-dev shoulds only be your Tests classes - see here, how the form package configures it
True, that composer dump-autoload and/or ./flow neos.flow:package:rescan has been the parts, that loaded your package files into the application, and make your action work