小编joe*_*e42的帖子

将扩展配置文件实体添加到FOS UserBundle

我正在尝试扩展FOS UserBundle,以允许扩展的配置文件实体除了基本的UserBundle字段之外还包含其他信息.因为我在网站上有多种类型的用户,所以我创建了单独的实体来保存配置文件信息.我将实体设置如下:

class UserProfile
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var integer
     */
    private $userId;

    /**
     * @var string
     */
    private $phone;

    /**
     * @var string
     */
    private $language;

    /**
     * @var string
     */
    private $company;

    /**
     * @var string
     */
    private $salutation;

    /**
     * @var string
     */
    private $fax;

    /**
     * @var string
     */
    private $region;
Run Code Online (Sandbox Code Playgroud)

我的配置

type: entity
table: user_profile
fields:
    id:
        type: integer
        id: true
        generator:
            strategy: AUTO
    phone:
        type: string
        length: '15' …
Run Code Online (Sandbox Code Playgroud)

php symfony fosuserbundle

8
推荐指数
1
解决办法
7354
查看次数

标签 统计

fosuserbundle ×1

php ×1

symfony ×1