my problem with the doctrine 2 orm schema tool is, that it drops a column (foreign key) which is defined in a parent class.
i have the following scenario:
namespace mycode\folderA;
class User {
/**
* @ManyToOne(targetEntity="Role", inversedBy="users")
* @JoinColumn(name="role_id", referencedColumnName="id")
* @var Role
*/
protected $role;
//getter and setter
}
running doctrine orm:schema-tool:update --dump-sql works pretty got, it creates a table with all defined column and sets the $role as foreign key with index. all good.
now i am trying to add some special fields for one special case so i inherit from my User class. the code look like:
namespace mycode\folderB;
use mycode\folderA\User as UserParent;
class User extends UserParent {
/**
* @Column(name="special", type="integer", nullable=true)
* @var integer
*/
protected $special;
//getter and setter
}
when i now run doctrine orm:schema-tool:update --dump-sql it shows my the adding of column "special" but ALSO the following:
DROP INDEX role ON user;
ALTER TABLE user DROP role_id;
i already tried to define the foreign key in the child user class as well, but without success.
so, my question is: what am i missing/what did i missunderstood?
thanks for your help!