using onDelete with Doctrine 2

后端 未结 2 1732
萌比男神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条回答
  •  臣服心动
    2021-02-09 18:03

    OK, got it! I had to use onDelete inside joinColumn:

    oneToOne:
        category:
            targetEntity: Category
            joinColumn:
                onDelete: CASCADE
    

提交回复
热议问题