rest - Restful web service giving error of Response does not contain any data -
i writing restful web service in symfony2. same service working fine on localhost returning response data not on server. print_r()
response variable , showing data array.
$user = new users(); $user->setusername($paramfetcher->get('email')); $password = $paramfetcher->get('password'); $user->setusertype('business'); if($password==""){ $user->setpassword(rand(0,1000)); }else{ $user->setpassword($password); } $data['userdetails']['id'] = $user->getid(); $data['userdetails']['username'] = $user->getusername(); $data['userdetails']['password'] = $user->getpassword(); $data['userdetails']['usertype'] = $user->getusertype(); $em->persist($user); $em->flush(); //print_r($data); print_r($buss); $response[]=array("code"=>200,"message"=>"success","data"=>$data);
please guide
if code inside controller function need return response. if want output json need return jsonresponse object:
return new \symfony\component\httpfoundation\jsonresponse($response);
Comments
Post a Comment