/** * {@inheritDoc} */ public function execute($request) { /** @var NotifyRequest $request */ $notification = new NotificationDetails(); if ($request instanceof SecuredNotifyRequest) { $notification->setPaymentName($request->getToken()->getPaymentName()); } else { $notification->setPaymentName('unknown'); } $notification->setDetails($request->getNotification()); $notification->setCreatedAt(new \DateTime()); $this->doctrine->getManager()->persist($notification); $this->doctrine->getManager()->flush(); }
/** * {@inheritDoc} */ public function onPreExecute($request) { if (false == $request instanceof NotifyRequest) { return; } if (in_array($request, $this->processedRequests)) { return; } /** @var NotifyRequest $request */ $notification = new NotificationDetails(); if ($request instanceof SecuredNotifyRequest) { $notification->setPaymentName($request->getToken()->getPaymentName()); } else { $notification->setPaymentName('unknown'); } $notification->setDetails($request->getNotification()); $notification->setCreatedAt(new \DateTime()); $this->doctrine->getManager()->persist($notification); $this->doctrine->getManager()->flush(); }