/** * {@inheritDoc} * * @param Notify $request */ public function execute($request) { $notification = new NotificationDetails(); $request->getToken() ? $notification->setGatewayName($request->getToken()->getGatewayName()) : $notification->setGatewayName('unknown'); $this->gateway->execute($getHttpRequest = new GetHttpRequest()); $notification->setDetails($getHttpRequest->query); $notification->setCreatedAt(new \DateTime()); $this->doctrine->getManager()->persist($notification); $this->doctrine->getManager()->flush(); }
/** * {@inheritDoc} */ public function onPreExecute(Context $context) { /** @var Notify $request */ $request = $context->getRequest(); if (false == $request instanceof Notify) { return; } if (in_array($request, $this->processedRequests)) { return; } $this->processedRequests[] = $request; $notification = new NotificationDetails(); $request->getToken() ? $notification->setGatewayName($request->getToken()->getGatewayName()) : $notification->setGatewayName('unknown'); $notification->setDetails($_REQUEST); $notification->setCreatedAt(new \DateTime()); $this->doctrine->getManager()->persist($notification); $this->doctrine->getManager()->flush(); }