Doctrine, multi-level inheritance not hydrate

拈花ヽ惹草 提交于 2019-12-11 23:42:14

问题


When I create a class child# that I fill its values and that I save it in DB (persistent, flush) I have no worries, all is database.

When I pick a Child# up from the database. All the attributes of the Parent1 are not hydrated, I do have those of the GrandParent, the Child# but not those of the Parent1, why?

/**
 * @ORM\Entity
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="class", type="int")
 * @ORM\DiscriminatorMap({
 *    0 = "Parent2",
 *    1 = "Child1", 
 *    2 = "Child2"})
 */
abstract class GrandParent { ... }

/** @ORM\Entity */
abstract class Parent1 extends GrandParent { ... }

/** @ORM\Entity */
class Parent2 extends GrandPArent { ... }

/** @ORM\Entity */
class Child1 extends Parent1 { ... }

/** @ORM\Entity */
class Child2 extends Parent1 { ... }

thanks for your help.

来源:https://stackoverflow.com/questions/49816728/doctrine-multi-level-inheritance-not-hydrate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!