Skip to content

Commit 26587c3

Browse files
authored
Add warning about the fact that the TreeBehavior can not handle concurrent requests (#8114)
and that the user need to implement it's own locking to prevent data corruption See cakephp/cakephp#17174 Signed-off-by: nook24 <d.ziegler@allgeier-its.com>
1 parent 3b82101 commit 26587c3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

en/orm/behaviors/tree.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The TreeBehavior helps you maintain a hierarchical data structure in the
1818
database that can be queried without much overhead and helps reconstruct the
1919
tree data for finding and displaying processes.
2020

21+
2122
Requirements
2223
============
2324

@@ -31,6 +32,16 @@ You can configure the name of those fields should you need to customize them.
3132
More information on the meaning of the fields and how they are used can be found
3233
in this article describing the `MPTT logic <https://www.sitepoint.com/hierarchical-data-database-2/>`_
3334

35+
.. warning::
36+
37+
The TreeBehavior is not safe for concurrent write operations.
38+
Simultaneous requests that modify tree-structured data
39+
(e.g., insertions, deletions, or moves) can lead to corruption of the
40+
``lft`` and ``rght`` values.
41+
42+
To prevent this, a locking mechanism like a
43+
`Semaphore <https://www.php.net/manual/en/book.sem.php>`_ should be used.
44+
3445
.. warning::
3546

3647
The TreeBehavior does not support composite primary keys at this point in

0 commit comments

Comments
 (0)