我想知道如果我想在客户创建订单后付款时触发某个功能,应该使用哪个事件。
我已经尝试过这个:state_enter.order_transaction.state.paid => 'onOrderCheckout'。
不幸的是,它给出了一个错误:“ 警告:使用未定义的常量 state_enter - 假设为 'state_enter'(这将在 PHP 的未来版本中引发错误)*”。
这是我的订阅者:
namespace Emakers\TransmissionPlugin\Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Shopware\Core\Checkout\Order\OrderEntity;
use Shopware\Core\Checkout\Order\OrderEvents;
use Shopware\Core\System\StateMachine\Event;
use Shopware\Core\Framework\Event\EventData\EntityType;
use Shopware\Core\System\SystemConfig\SystemConfigService;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Emakers\TransmissionPlugin\Services\ShopwareConnectService;
class OrderSubscriber implements EventSubscriberInterface
{
/**
* @ContainerInterface $container
*/
private $container;
/**
* @var datetime
*/
private $now;
public function __construct(ContainerInterface $container) {
$this->container = $container;
$this->now = date('Y-m-d H:i:s');
}
public static function getSubscribedEvents(): array
{
return [
'state_enter.order_transaction.state.paid' => 'onOrderCheckout',
];
}
public function orOrderCheckout($event)
{
var_dump($event);
die('here we are');
}
}
海绵宝宝撒