php - How to use the fosuserbundle usermanager from a different bundle -
I am new to Symphony.
I created a new bundle called Basebandle and set the Fosserbundle according to the instructions. User class resides in baseband.
I wanted to create the user admin interface in a new bundle by the name of an administrator administrator. I need a route that gives Jason all users So I set it up and made this verb:
public function ajaxAction () {$ um = $ this- & gt; Obtain ('fos_user.user_manager'); $ User = $ um- & gt; Search Users (); // Create a JSON-response with a 200 position code $ response = new response (json_encode (array ('name' = & gt; $ user))); $ Response- & gt; Header-> Set ('content-type', 'app / jason'); $ Refund; }
I get an error:
Error: Call a member function () C: \ wamp \ www \ Quirements \ vendor \ symfony \ Symfony \ src \ symfony \ bundle \ frameworkbundle \ controller \ controllroll.php line 274
When I move this function to baseband default controller, then it works fine ... What am i doing wrong