Can I access discriminator field from php in doctrine2?

后端 未结 8 701
遇见更好的自我
遇见更好的自我 2020-12-01 04:44

I have an entity which defines inheritance like this:

* @DiscriminatorColumn(name=\"type\", type=\"string\")
* @DiscriminatorMap({\"text\" = \"TextAttribute\         


        
8条回答
  •  离开以前
    2020-12-01 05:08

    Use something like this if you want, like me, avoid use of const :

    public function getType()
    {
        $type = explode('\\', get_class($this));
    
        return end($type);
    }
    

提交回复
热议问题