Sadly, this isn’t really documented (at time of writing).
Adding new protected variables to your User.php entity will not actually create database entries when you try to do a doctrine:schema:update.
While one still needs to have the protected variables in this entity class, along with getters and setters, the actual creation work is within UserBundle/Resources/config/doctrine/User.orm.xml
Here is an example for adding a foreign key:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?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="ApplicationSonataUserBundleEntityUser" table="fos_user_user"> <id name="id" column="id" type="integer"> <generator strategy="AUTO" /> </id> <many-to-one field="client" target-entity="MyvendorMyBundleEntityClient" orphan-removal=""> <join-columns> <join-column name="client_id" referenced-column-name="id" nullable="1"/> </join-columns> </many-to-one> </entity> </doctrine-mapping> |