Php 从父表中删除记录

Php 从父表中删除记录,php,symfony,doctrine-orm,Php,Symfony,Doctrine Orm,我有两个实体 entityA.php和entityB.php /** * * @ORM\Table(name="mytable_b") * @ORM\Entity(repositoryClass="ACME\myBundle\Entity\entityBRepository") */ class entityB extends entityA { entityA.php /** * * @ORM\Table(name="mytable") * @ORM\InheritanceTy

我有两个实体 entityA.php和entityB.php

/**
 *
 * @ORM\Table(name="mytable_b")
 * @ORM\Entity(repositoryClass="ACME\myBundle\Entity\entityBRepository")
 */
class entityB extends entityA
{
entityA.php

/**
 *
 * @ORM\Table(name="mytable")
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="discr", type="string")
 * @ORM\DiscriminatorMap({
 *          "foo"                        = "ACME\myBundle\Entity\entityB",
 * })
 * @ORM\Entity(repositoryClass="ACME\myBundle\Entity\entityARepository")
 */
class entityA
{
..more code
entityB.php

/**
 *
 * @ORM\Table(name="mytable_b")
 * @ORM\Entity(repositoryClass="ACME\myBundle\Entity\entityBRepository")
 */
class entityB extends entityA
{
我想要删除对象表单entityB和(无需查询)删除entityA


如果我删除表单entityA“自动”删除表单entityB,但没有替代项A

您可以使用设置为您的eEntityB的
postRemove
实体侦听器来删除父实体。

我可以使用postRemove之类的工具吗?