symfony - Delete parent entity on deleting child -
my problem parent entity not delete when i'm deleting child. have comment entity , 2 inheritance entities artcomment , postcomment. each 1 associated art or post entity. when i'm deleting post entity cascade deleting automaticly deletes postcomment in database comment not deleted.
comment:
/** * comment * @orm\entity * @orm\inheritancetype("joined") * @orm\discriminatorcolumn(name="discr", type="string") * @orm\discriminatormap({"comment" = "comment", "art_comment" = "artcomment", "post_comment" = "postcomment"}) */ class comment { } postcomment:
/** * @orm\entity() */ class postcomment extends comment { /** * @orm\manytoone(targetentity="post", inversedby="comments", cascade={"remove"}) * @orm\joincolumn(name="parent_id", referencedcolumnname="id", ondelete="cascade") */ private $parent; } i trying deal creating trigger run after deleting artcomment , delete comment solution not working.
Comments
Post a Comment