webhookRepo->requireForStation($id, $request->getStation()); $newValue = !$record->getIsEnabled(); $record->setIsEnabled($newValue); $em = $this->webhookRepo->getEntityManager(); $em->persist($record); $em->flush(); $flash_message = ($newValue) ? __('Web hook enabled.') : __('Web hook disabled.'); return $response->withJson(new Entity\Api\Status(true, $flash_message)); } }