So the question is pretty straightforward. I have a code in my controller that has became redundant, and i've decided to make the annotation for it.
if (!$request->getContentType() === 'json' ) {
return new JsonResponse(array('success' => false));
}
$content = $request->getContent();
if(empty($content)){
throw new BadRequestHttpException("Content is empty");
}
$data = json_decode($content, true);
if(empty($data) || !array_key_exists('type', $data)) {
return new JsonResponse(array('success' => false));
}
How do i make custom annotation @CheckRequest in which I can use the $request object as a parameter?