JTL Import

This commit is contained in:
Marko
2023-06-19 09:20:14 +02:00
parent 30a8e73f21
commit 873162859c
7 changed files with 153 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ namespace App\EventSubscriber;
use ApiPlatform\Symfony\EventListener\EventPriorities;
use App\Helper\Slack;
use App\Entity\Order;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ViewEvent;
@@ -17,10 +18,12 @@ class SlackNotifySubscriber implements EventSubscriberInterface
* @var Slack
*/
public $slack;
public $logger;
public function __construct(ChatterInterface $chatter)
public function __construct(ChatterInterface $chatter, LoggerInterface $logger)
{
$this->slack = new Slack($chatter);
$this->logger = $logger;
}
public static function getSubscribedEvents(): array
@@ -40,6 +43,9 @@ class SlackNotifySubscriber implements EventSubscriberInterface
$order = $event->getControllerResult();
$method = $event->getRequest()->getMethod();
$this->logger->info('SlackNotifySubscriber: ' . $method);
//$this->logger->info('SlackNotifySubscriber: ' . $order);
//wenn es keine Bestellung ist oder es kein POST Request ist, dann return
if (!$order instanceof Order || Request::METHOD_POST !== $method) {
return;