Skip to content

Commit c895f0f

Browse files
authored
Update counter-cache.rst (#7927)
Update counter-cache.rst Refs cakephp/cakephp#17966
1 parent 7dd2386 commit c895f0f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

en/orm/behaviors/counter-cache.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ then updates the counter of the *previously* associated item.
131131
behavior to the ``CommentsTable`` in order to generate ``comment_count`` for
132132
Articles table.
133133

134+
.. versionchanged:: 5.1.2
135+
136+
As of CakePHP 5.1.2, the counter cache values are updated using a single
137+
query using sub-queries, instead of separate queries, to fetch the count and
138+
update a record. If required you can disable the use of sub-queries by
139+
setting `useSubQuery` key to `false` in the config
140+
`['Articles' => ['comment_count' => ['useSubQuery' => false]]`
141+
134142
Belongs to many Usage
135143
=====================
136144

0 commit comments

Comments
 (0)