[BUGFIX] Mention correct class and function in rst file
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / 8.3 / Breaking-76259-SignatureOfMethodSetTotalItemsChangedInAbstractDatabaseRecordList.rst
1
2 .. include:: ../../Includes.txt
3
4 =====================================================================================
5 Breaking: #76259 - Signature of setTotalItems() in AbstractDatabaseRecordList changed
6 =====================================================================================
7
8 See :issue:`76259`
9
10 Description
11 ===========
12
13 As part of migrating the core code to use Doctrine DBAL the signature of the method
14 :php:`AbstractDatabaseRecordList::setTotalItems()` has changed.
15
16 The new signature is:
17
18 .. code-block:: php
19
20 public function setTotalItems(string $table, int $pageId, array $constraints)
21 {
22 $queryBuilder = $this->getQueryBuilder($table, $pageId, $constraints);
23 $this->totalItems = (int)$queryBuilder->count('*')
24 ->execute()
25 ->fetchColumn();
26 }
27
28 The parameter `$constraints` is expected to be an array of Doctrine Expressions
29 or SQL fragments.
30
31 In case of SQL fragments proper quoting needs to be ensured by the invoking method.
32 SQL fragments should not have a leading ` AND ` SQL operator.
33
34
35 Impact
36 ======
37
38 3rd party extensions using :php:`AbstractDatabaseRecordList::setTotalItems()` need
39 to update the method invocation.
40
41
42 Affected Installations
43 ======================
44
45 Installations using 3rd party extensions that use :php:`AbstractDatabaseRecordList::setTotalItems()`.
46
47
48 Migration
49 =========
50
51 Instead of passing an array of parameters built using the deprecated ::php::`makeQueryArray()` method
52 explicitly pass in the table name, page id and any additional query restrictions required.
53
54 .. index:: Database, PHP-API