using onDelete with Doctrine 2

后端 未结 2 1747
萌比男神i
萌比男神i 2021-02-09 17:45

I can\'t get the onDelete to work in Doctrine2 (with YAML Mapping).

I tried this relation in my Product class:

oneToOne:
    category:
              


        
2条回答
  •  -上瘾入骨i
    2021-02-09 18:05

    This is the way to use onDelete in joinTable:

    manyToMany:
        parameters:
            targetEntity: Fox\LandingBundle\Entity\Parameter
            cascade: ["persist","remove"]
            joinTable:
                name: subscriberBox_parameter
                joinColumns:
                    subscriberBox_id:
                        referencedColumnName: id
                inverseJoinColumns:
                    parameter_id:
                        referencedColumnName: id
                        onDelete: CASCADE
    

提交回复
热议问题