Hallo, habe analog zu anderen Plugins in der service.xml in einen Subscriber eine Klasse eingebunden, bekomme aber die Errormeldung:
Uncaught Exception: The service "WtCustomerRegistration\Subscriber\CustomerRegistration" has a dependency on a non-existent service "WtCustomerRegistration\Service\Mailer".
Was läuft da schief?
Hier ein Auszug aus der composer.json:
"extra": {
"shopware-plugin-class": "WtCustomerRegistration\\WtCustomerRegistration",
"label": {
"de-DE": "Product Registration Plugin",
"en-GB": "Product Registration Plugin"
}
},
Hier die services.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="WtCustomerRegistration\Subscriber\CustomerRegistration">
<argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
<argument type="service" id="WtCustomerRegistration\Service\Mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
</services>
</container>
Hier die Mailler Klasse:
<?php
namespace WtCustomerRegistration\Service;
/**
*
*/
class Mailer
{
}
Und hier der Subscriber:
<?php declare(strict_types=1);
namespace WtCustomerRegistration\Subscriber;
use JetBrains\PhpStorm\NoReturn;
use Shopware\Storefront\Event\StorefrontRenderEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\System\SystemConfig\SystemConfigService;
use WtCustomerRegistration\Service\Mailer;
/**
*
*/
class CustomerRegistration implements EventSubscriberInterface
{
private SystemConfigService $systemConfigService;
private Mailer $mailer;
public function __construct(SystemConfigService $systemConfigService,Mailer $mailer)
{
$this->systemConfigService = $systemConfigService;
$this->mailer=$mailer;
}
public static function getSubscribedEvents(): array
{
// Return the events to listen to as array like this: <event to listen to> => <method to execute>
return [
StorefrontRenderEvent::class => 'onStoreFrontLoaded',
];
}
#[NoReturn] public function onStoreFrontLoaded(StorefrontRenderEvent $event): void
{
// Do something
// E.g. work with the loaded entities: $event->getEntities()
}
}
Was läuft da schief?