/** * @param Request $request * @param $webHook * * @return array */ private function handleNotification(Request $request, $webHook) { $em = $this->get('doctrine.orm.default_entity_manager'); $notification = new Notification(); $notification->setWebHook($webHook); $requestData = ['method' => $request->getMethod(), 'headers' => $request->headers->all(), 'query' => $request->query->all(), 'body' => $request->getContent()]; $notification->setContent(json_encode($requestData)); $em->persist($notification); $em->flush(); return $requestData; }