【发布时间】:2016-02-04 23:59:44
【问题描述】:
我有许多从一个父实体扩展而来的实体。
我想只从其中一列中删除一列或多列,同时保留继承。
我试图通过将父实体映射为MappedSuperClass 来找到解决方案,但它没有帮助。
例子:
<?php
/** @ORM\Entity */
class Base
{
/** @ORMColumn(name="foo", type="string") */
protected $foo;
/** @ORMColumn(name="bar", type="string") */
protected $bar
}
/**
* @ORM\Entity
*/
class Child extends Base
{
// How take only the Base::$bar column mapping
// and not the Base::$foo column mapping
}
整个教义文档的Inheritance mapping 章节没有给我任何选择。
我需要真正从数据库中删除/排除列,序列化并不能解决我的问题。
有没有办法做到这一点?
【问题讨论】:
标签: php symfony inheritance doctrine-orm