Paul
I’m a beginner with PHP, so please forgive my lack of experience here. I’m going through this tutorial step by step and simultaneously researching the bits that don’t make sense. I’ve run into the following error while constructing the API backend:
/**
* @Route("/movies", methods=“POST”)
*/
public function create(Request $request, MovieRepository $movieRepository, EntityManagerInterface $em)
{
$request = $this->transformJsonBody($request);
if (! $request) {
return $this->respondValidationError(‘Please provide a valid request!’);
}
The transformJsonBody method is showing as undefined in my code editor (VSCode with Intelliphense). I’m also using PHP version 7.4 and Symfony v 5.2.7. I saw in the JsonResponse.php file that the create() function has been depracated, and to use __construct() instead, but I’m not sure how to implement this into my code, or if this is even the fix I need.