Hi!
I try to bulid my own schema. I have classes from ApplicationSonataUserBulnde whch extends SonataUserBundle.
Original vendor\sonata-project\user-bundle\Resources\config\doctrine\ BaseUser.orm.xml is:
<?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="Sonata\UserBundle\Entity\BaseUser">
<field name="createdAt" type="datetime" column="created_at" />
<field name="updatedAt" type="datetime" column="updated_at" />
<!-- Profile fields -->
<field name="dateOfBirth" type="datetime" column="date_of_birth" nullable="true" />
<field name="firstname" type="string" column="firstname" length="64" nullable="true" />
<field name="lastname" type="string" column="lastname" length="64" nullable="true" />
<field name="website" type="string" column="website" length="64" nullable="true" />
<field name="biography" type="string" column="biography" length="255" nullable="true" />
<field name="gender" type="string" column="gender" length="1" nullable="true" />
<field name="locale" type="string" column="locale" length="8" nullable="true" />
<field name="timezone" type="string" column="timezone" length="64" nullable="true" />
<field name="phone" type="string" column="phone" length="64" nullable="true" />
<!-- social fields -->
<field name="facebookUid" type="string" column="facebook_uid" length="255" nullable="true" />
<field name="facebookName" type="string" column="facebook_name" length="255" nullable="true" />
<field name="facebookData" type="json" column="facebook_data" nullable="true" />
<field name="twitterUid" type="string" column="twitter_uid" length="255" nullable="true" />
<field name="twitterName" type="string" column="twitter_name" length="255" nullable="true" />
<field name="twitterData" type="json" column="twitter_data" nullable="true" />
<field name="gplusUid" type="string" column="gplus_uid" length="255" nullable="true" />
<field name="gplusName" type="string" column="gplus_name" length="255" nullable="true" />
<field name="gplusData" type="json" column="gplus_data" nullable="true" />
<!-- extra security fields -->
<field name="token" type="string" length="255" column="token" nullable="true" />
<field name="twoStepVerificationCode" type="string" length="255" column="two_step_code" nullable="true" />
<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="prePersist" />
<lifecycle-callback type="preUpdate" method="preUpdate" />
</lifecycle-callbacks>
</mapped-superclass>
</doctrine-mapping>
ApplicationSonataUserBundle has original src\Application\Sonata\UserBundle\Resources\config User.orm.xml:
<?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">
<entity name="Application\Sonata\UserBundle\Entity\User" table="fos_user_user">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
</entity>
</doctrine-mapping>
When I import it and my one association and then export I get User.orm.xml:
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Application\Sonata\UserBundle\Entity\User" table="fos_user_user">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<field name="username" type="string" length="255" nullable="true" column="username"/>
<field name="usernameCanonical" type="string" unique="true" length="255" nullable="true" column="username_canonical"/>
<field name="email" type="string" length="255" nullable="true" column="email"/>
<field name="emailCanonical" type="string" unique="true" length="255" nullable="true" column="email_canonical"/>
<field name="enabled" type="boolean" nullable="true" column="enabled"/>
<field name="salt" type="string" nullable="true" column="salt"/>
<field name="password" type="string" nullable="true" column="password"/>
<field name="lastLogin" type="datetime" nullable="true" column="last_login"/>
<field name="locked" type="boolean" nullable="true" column="locked"/>
<field name="expired" type="boolean" nullable="true" column="expired"/>
<field name="expiresAt" type="datetime" nullable="true" column="expires_at"/>
<field name="confirmationToken" type="string" nullable="true" column="confirmation_token"/>
<field name="passwordRequestedAt" type="datetime" nullable="true" column="password_requested_at"/>
<field name="roles" type="array" nullable="true" column="roles"/>
<field name="credentialsExpired" type="boolean" nullable="true" column="credentials_expired"/>
<field name="credentialsExpireAt" type="datetime" nullable="true" column="credentials_expire_at"/>
<one-to-many field="store" target-entity="Krawet\AppBundle\Entity\Store" mapped-by="user"/>
</mapped-superclass>
</doctrine-mapping>
When I try to update doctrine schema I get error about duplicate username as it apparently is duplicate.
I also can't use bidirectional association when User is change to mapped-superclass (http://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html).
Is there a way to and bidirectional reference to my Krawet\AppBundle\Entity\Store and have entrity in User.orm.xml instead od mapped-superclass?