gpt4 book ai didi

tree - 教义 2 : Tree - Nestedset and InnoDB

转载 作者:行者123 更新时间:2023-12-04 06:17:30 27 4
gpt4 key购买 nike

我正在使用 Doctrine's 2 Tree-Nestedset extension使用 MySQL IndoDB 数据库。

yml 表架构如下所示:

Ext\Entity\PageElement:
type: entity
table: page_element
repositoryClass: Gedmo\Tree\Entity\Repository\NestedTreeRepository
gedmo:
tree:
type: nested
id:
id:
type: integer
generator:
strategy: AUTO
fields:
element_object_data:
type: array
nullabe: true
element_object_type:
type: string
nullable: true
lft:
type: integer
gedmo:
- treeLeft
rgt:
type: integer
gedmo:
- treeRight
root:
type: integer
gedmo:
- treeRoot
lvl:
type: integer
gedmo:
- treeLevel
sort_order:
type: integer
nullable: true
created:
type: datetime
gedmo:
timestampable:
on: create
updated:
type: datetime
gedmo:
timestampable:
on: update
manyToOne:
parent:
targetEntity: Ext\Entity\PageElement
inversedBy: children
gedmo:
- treeParent
oneToMany:
children:
targetEntity: Ext\Entity\PageElement
mappedBy: parent

尝试删除任何包含子节点的节点时出现 mysql 错误:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (page_element, CONSTRAINT page_element_ibfk_1 FOREIGN KEY (parent_id) REFERENCES page_element (id))



我知道这是因为 InnoDB 引用限制,但我不确定如何避免它?

最佳答案

答案在 github issue tracker

关于tree - 教义 2 : Tree - Nestedset and InnoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7048991/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com