Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tognit opened this issue Aug 15, 2023 · 0 comments

Comments

@tognit
Copy link

tognit commented Aug 15, 2023

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);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant