Zitat von
Spooky
Öffne dazu ein Ticket auf GitHub.
Einstweilen musst du die Autoload Definition selbst hinzufügen. Dann die Abhängigkeiten nochmals installieren.
Habe es gemacht, meine Methode wird dennoch nicht gerufen (kein dump, kein die).
Hier nochmal alle meine Änderungen:
composer.json:
Code:
{
"type": "project",
"require": {
"codefog/contao-cookiebar": "^2.2",
"contao-themes-net/mate-theme-bundle": "2.8.5",
"contao/calendar-bundle": "4.9",
"contao/comments-bundle": "4.9",
"contao/conflicts": "*@dev",
"contao/faq-bundle": "4.9",
"contao/listing-bundle": "4.9",
"contao/manager-bundle": "4.9",
"contao/news-bundle": "4.9",
"contao/newsletter-bundle": "4.9",
"contaoacademy/contao-videohandbuch": "^1.1",
"metamodels/bundle_start": "2.1.2",
"metamodels/contao-frontend-editing": "^2.1",
"terminal42/contao-conditionalformfields": "^2.2",
"terminal42/contao-leads": "^1.4",
"terminal42/contao-mailusername": "^1.0",
"terminal42/notification_center": "^1.5"
},
"extra": {
"contao-component-dir": "assets"
},
"scripts": {
"post-install-cmd": [
"Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
],
"post-update-cmd": [
"Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
]
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
}
}
Code:
// ../src/EventListener/processFormDataListener.php
// Aufruf: nach Absenden des Mitgliedsantragsformulars
// Funktionen:
//
// 01. Test: setze Mitgliedsbeitra auf 80
// 02.
namespace App\EventListener;
use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\FrontendTemplate;
use Contao\Module;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;
class processFormDataListener implements ServiceAnnotationInterface
{
/**
* @Hook("processFormData", priority=-10)
*/
public function onProcessFormData(array $submittedData, array $formData, array $files, array $labels, Form $form ): void
{
dump($formData, $form); die();
// if ('Mitgliedsantrag-Test' === $form->formId) {
// $submittedData['fee'] = '80';
// }
if ($form->formId == 'Mitgliedsantrag-Test') {
$submittedData['fee'] = '80';
}
// if (23 === (int) $form->id) {
// $submittedData['fee'] = '80';
// }
}
}
Über Contao Manager:
Produktionscache erneuert,
Composer Class Loader aktualisiert,
Composer-Abhängigkeiten Installer ausgeführt
Keine services.yml und keine routing.yml.
Irgendwas fehlt oder ist falsch konfiguriert. Stichwort: namesspace wurde schon mal angemeckert.
Lesezeichen