Quantcast
Viewing all articles
Browse latest Browse all 295247

Remove public properties from StatementInterface implementations

Problem/Motivation

From #3174662: Encapsulate \PDOStatement instead of extending from it.

The Statement* classes have public properties like $dbh and $allowRowCount, historically to support tight integration with PDO.

With #3174662: Encapsulate \PDOStatement instead of extending from it, the PDO integration was relaxed, and we could revisit that in order to implement a more clean approach with protected properties and getters/setters.

Proposed resolution

move $dbh and $allowRowCount to the magic getter for BC with deprecation trigger, make an alternative set of protected properties for that, introduce getters (and setters if necessary), and use them across - will have to touch the other StatementInterface implementations

Remaining tasks

User interface changes

API changes

The method Drupal/Core/Database/Connection::prepareStatement() has a new parameter called $allow_row_count, which is a boolean value and default to FALSE. When set to TRUE allows the method Drupal\Core\Database\StatementInterface::rowCount() return the number of affected rows in the query.

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>