Category : events

I’m trying to create a listener to when a new Rating is created. I followed all the documentation but I keep getting the same error: Argument 1 passed to "SymfonyComponentEventDispatcherEventDispatcherInterface::dispatch()" must be an instance of "SymfonyComponentEventDispatcherEvent", "AppEventAverageRatingEvent" given. I’m trying to use SymfonyComponentEventDispatcherEvent in the event but it keeps saying that it is deprecated and ..

Read more

**I’m getting the following error: ** Service "event_dispatcher" not found: even though it exists in the app’s container, the container inside "AppControllerRatingApiController" is a smaller service locator that only knows about the "form.factory", "http_kernel", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session" and "twig" services. Try using dependency injection instead. I’m used to using $this->get(‘event_dispatcher’)->dispatch( ..

Read more

I’m having a problem getting the correct value for one of the user variables. I create PasswordExpirationListener : PasswordExpirationListener::onCheckExpiration() To force users to change their passwords after expiration : This listener works perfectly. PasswordExpirationListener::onCheckExpirationSoon() When the user login check if the validity of PWD less than 7 days and display a flash msg : when ..

Read more

I would like to know which event should I use if I want to trigger a function when an order is PAID after its creation by the cusstomer. I have already tried with this one : state_enter.order_transaction.state.paid => ‘onOrderCheckout’. Unfortunately, it gave an error :" Warning: Use of undefined constant state_enter – assumed ‘state_enter’ (this ..

Read more

Orders in Shopware 6 have these states: <?php declare(strict_types=1); namespace ShopwareCoreCheckoutOrder; final class OrderStates { public const STATE_MACHINE = ‘order.state’; public const STATE_OPEN = ‘open’; public const STATE_IN_PROGRESS = ‘in_progress’; public const STATE_COMPLETED = ‘completed’; public const STATE_CANCELLED = ‘cancelled’; } Is it possible to subscribe to the state changes? Is there a state change ..

Read more