/**
* @MappedSuperclass
* @Table(indexes={@Index(name="idx", columns={"name"})})
*/
class BaseSuperClass
{
/** @Column(type="string") */
protected $name;
// ... more fields and methods
}
/** @Entity */
class EntitySubClass extends BaseSuperClass
{
/** @Id @Column(type="integer") */
private $id;
// ... more fields and methods
}
Name index is not inherited from BaseSuperClass, it there any way to achieve this?
@Table is not valid on a mappedsuperclass.
On 10 Jul 2016 16:46, "Yoan Arnaudov" [email protected] wrote:
/**
- @MappedSuperclass
- @Table(indexes={@Index(name="idx", columns={"name"})})
_/
class BaseSuperClass
{
/_* @Column(type="string") */
protected $name;// ... more fields and methods
}/** @Entity _/
class EntitySubClass extends BaseSuperClass
{
/_* @Id @Column(type="integer") */
private $id;// ... more fields and methods}
Name index is not inherited from BaseSuperClass, it there any way to
achieve this?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/5928, or mute the thread
https://github.com/notifications/unsubscribe/AAJakHTYvOtepqSIm5ZYPA1b08TXvRmAks5qUQXSgaJpZM4JI2Uw
.
Okay, but is there any way to achieve this?
@nacholibre or @Ocramius, Did you find a way to inherit indexes with a mapped superclass? I have tons of entities that would benefit from a feature as such.
Did you find a way to inherit indexes with a mapped superclass?
Listeners - simply attach a listener that, when the metadata loads, adds the indexes to all classes that are instance of a certain mapped superclass.
I posted a full solution for the listener suggested by @Ocramius at https://stackoverflow.com/a/60029840/1668200
Most helpful comment
Okay, but is there any way to achieve this?