I am new to symfony
I created a new bundle called basebundle and installed fosuserbundle per the directions. The user class lives in the basebundle.
I wanted to create a user admin interface in a new bundle called adminbundle. I need a route that returns all users in json. so i set that up and created this action:
public function ajaxAction(){
$um = $this->get('fos_user.user_manager');
$users = $um->findUsers();
// create a JSON-response with a 200 status code
$response = new Response(json_encode(array('name' => $users)));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
I get an error:
Error: Call to a member function get() on a non-object in C:\wamp\www\quirements\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\Controller.php line 274
when i move this function to the basebundle default controller it works fine.... what am i doing wrong?