Creating a custom field using FOSUserBundle

I want to add the address and phone number using FOSUserBundle. How to add custom fields, with FOSuserBundle, have a profile containing the address and phone number ....

+4
source share
3 answers

The problem is this: when I follow the symfony documentation: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md in step a) Doctrine class ORM User I created the doctrine of the folder containing User. orm.yml:

SRC / Acme / UserBundle / Resources / Configurations / Doctrine / User.orm.yml

Acme\UserBundle\Entity\User:   type: entity   : fos_user    :        :           :           :               : AUTO

. .

+2

, MyCompanyUserBundle.php

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

UserBundle FOS:

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="user")
*/
class User extends BaseUser
{

    public function __toString(){
        return $this->firstname . ' ' . $this->lastname . ' (' . $this->email . ')';
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }



}

:

fos_user:
        db_driver: orm
        firewall_name: main
        user_class: MyCompany\UserBundle\Entity\User
+2

Source: https://habr.com/ru/post/1527517/


All Articles