markocupic / calendar-event-booking-bundle

Contao 4 Extension
13 stars 7 forks source link

App\EventListener\DoSomething::__invoke(): Argument #1 ($form) must be of type #60

Open tognit opened 1 year ago

tognit commented 1 year ago

Hallo markocupic

Contao 4.13.29 CalenderEventBooking: 6.x-dev

Wenn ich z.B. den HOOK "calEvtBookingPostBooking" gemäss Beispiel vom "README.md" verwenden möchte, erhalte ich nachfolgende Fehlermeldung ...

App\EventListener\DoSomething::__invoke(): Argument #1 ($form) must be of type Codefog\HasteBundle\Form\Form, Markocupic\CalendarEventBookingBundle\EventBooking\Config\EventConfig given, called in /home/webbraue/public_html/vigw/vendor/markocupic/calendar-event-booking bundle/src/EventListener/ContaoHooks/ProcessFormData/AddEventSubscription.php on line 92

Wenn man "$fom" weglässt, kommt die nachfolgende Meldung ...

App\EventListener\DoSomething::__invoke(): Argument #2 ($eventMember) must be of type Markocupic\CalendarEventBookingBundle\Model\CalendarEventsMemberModel, Markocupic\CalendarEventBookingBundle\EventBooking\EventRegistration\EventRegistration given, called in /home/webbraue/public_html/vigw/vendor/markocupic/calendar-event-booking-bundle/src/EventListener/ContaoHooks/ProcessFormData/AddEventSubscription.php on line 92

Und noch "$eventMember" weg lassen ...

App\EventListener\DoSomething::__invoke(): Argument #2 ($formDetails) must be of type array, Markocupic\CalendarEventBookingBundle\EventBooking\EventRegistration\EventRegistration given, called in /home/webbraue/public_html/vigw/vendor/markocupic/calendar-event-booking-bundle/src/EventListener/ContaoHooks/ProcessFormData/AddEventSubscription.php on line 92

Nur der nachfolgende Code wird ohne Fehlermeldung ausgeführt ...

<?php
// src/EventListener/DoSomething.php

declare(strict_types=1);

namespace App\EventListener;

use Codefog\HasteBundle\Form\Form;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Markocupic\CalendarEventBookingBundle\Controller\FrontendModule\EventBookingController;
use Markocupic\CalendarEventBookingBundle\EventBooking\Config\EventConfig;
use Markocupic\CalendarEventBookingBundle\EventListener\ContaoHooks\AbstractHook;
use Markocupic\CalendarEventBookingBundle\EventListener\ContaoHooks\PostBooking\Notification;
use Markocupic\CalendarEventBookingBundle\Model\CalendarEventsMemberModel;

 #[AsHook(DoSomething::HOOK, priority: 9000)]
final class DoSomething extends AbstractHook
{
    public const HOOK = 'calEvtBookingPostBooking';

    public function __invoke(EventConfig $eventConfig): void
    {
        dd($eventConfig);
    }
}