symfony - Creating Custom Field with FOSUserBundle -


I want to use an address and telephone number FOSUserBundle how can I add a custom field to FOSuserBundle , Which includes profiles and telephone numbers ....

Create your user bundle and MyCompanyUserBundle.php You set

  public function getParent () {return 'FOSUserBundle'; }  

Then you create a user unit in your new user bundle and extend it from the user based on the FOS user bundle:

  Use FOS \ UserBundle \ Model \ User As Ususer; Use the theory / ORM \ mapping as an ORM; / ** * @ORM \ Entity * @ORM \ Table (name = "user") * / Class user spreads to BaseSuccess {public function __toString () {return $ this- & gt; Firstname ''. $ This- & gt; Last name '('. $ This-> Email. ')'; } / ** * Get Id * * @ Return Integer * / Public Function getId () {Return- $$ This-> ID; }}  

Edit

Also set the user to Config:

  fos_user: db_driver : Orm firewall_name: main user_class: MyCompany \ UserBundle \ unit \ user  

Comments