php - Symfony2 override User.orm.xml -


i need override symfony\vendor\friendsofsymfony\user-bundle\fos\userbundle\resources\config\doctrine\model\user.orm.xml file.

<?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"                   xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                   xsi:schemalocation="http://doctrine-project.org/schemas/orm/doctrine-mapping                   http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">      <mapped-superclass name="fos\userbundle\model\user">          <field name="username" column="username" type="string" length="255" />          <field name="usernamecanonical" column="username_canonical" type="string" length="255" unique="true" />          <field name="email" column="email" type="string" length="255" />          <field name="emailcanonical" column="email_canonical" type="string" length="255" unique="true" />          <field name="enabled" column="enabled" type="boolean" />          <field name="salt" column="salt" type="string" />          <field name="password" column="password" type="string" />          <field name="lastlogin" column="last_login" type="datetime" nullable="true" />          <field name="locked" column="locked" type="boolean" />          <field name="expired" column="expired" type="boolean" />          <field name="expiresat" column="expires_at" type="datetime" nullable="true" />          <field name="confirmationtoken" column="confirmation_token" type="string" nullable="true" />          <field name="passwordrequestedat" column="password_requested_at" type="datetime" nullable="true" />          <field name="roles" column="roles" type="array" />          <field name="credentialsexpired" column="credentials_expired" type="boolean" />          <field name="credentialsexpireat" column="credentials_expire_at" type="datetime" nullable="true" />      </mapped-superclass>  </doctrine-mapping> 

i need change field:

<field name="email" column="email" type="string" length="255" /> 

to this:

<field name="email" column="email_address" type="string" length="255" /> 

i add getparent method userbundle. have copied symfony\vendor\friendsofsymfony\user-bundle\fos\userbundle\resources\config\doctrine\model\user.orm.xml bundle symfony\src\acme\userbundle\resources\doctrine\model\user.orm.xml when changed not see effect. doing wrong?

i have figured out. solution add special annotation user entity create earlier form fosuserbundle documentation.

 * @orm\attributeoverrides({  *      @orm\attributeoverride(name="email", column=@orm\column(type="string", name="email_address", length=255)),  * }) 

the whole class should like:

<?php namespace acme\userbundle\entity;  use fos\userbundle\model\user baseuser; use doctrine\orm\mapping orm;  /**  * @orm\entity  * @orm\table(name="sf_guard_user")  * @orm\attributeoverrides({  *      @orm\attributeoverride(name="email", column=@orm\column(type="string", name="email_address", length=255)),  * })  */ class user extends baseuser {     /**      * @orm\id      * @orm\column(type="integer")      * @orm\generatedvalue(strategy="auto")      */     protected $id;      public function __construct()     {         parent::__construct();         // own logic     } } 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -