Breaking: #76259 - Signature of setTotalItems() in AbstractDatabaseRecordList changed

See forge#76259

Description

As part of migrating the core code to use Doctrine DBAL the signature of the method AbstractDatabaseRecordList::setTotalItems() has changed.

The new signature is:

public function setTotalItems(string $table, int $pageId, array $constraints)
{
    $queryBuilder = $this->getQueryBuilder($table, $pageId, $constraints);
    $this->totalItems = (int)$queryBuilder->count('*')
        ->execute()
        ->fetchColumn();
}

The parameter $constraints is expected to be an array of Doctrine Expressions or SQL fragments.

In case of SQL fragments proper quoting needs to be ensured by the invoking method. SQL fragments should not have a leading ` AND ` SQL operator.

Impact

3rd party extensions using AbstractDatabaseRecordList::setTotalItems() need to update the method invocation.

Affected Installations

Installations using 3rd party extensions that use AbstractDatabaseRecordList::setTotalItems().

Migration

Instead of passing an array of parameters built using the deprecated makeQueryArray() method explicitly pass in the table name, page id and any additional query restrictions required.