mondrake / drudbal
Drupal driver for Doctrine DBAL.
Installs: 2 765
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 1
Open Issues: 2
Type:drupal-module
Requires
- php: >=8.1
- composer-runtime-api: ^2.0.0
- doctrine/dbal: ^4
- drupal/core: ^11
- drush/drush: ^13
This package is auto-updated.
Last update: 2024-10-31 00:17:10 UTC
README
(This README updated March 30, 2020)
An experimental Drupal database driver for Doctrine DBAL. Do not use if not for trial. No support, sorry :)
Concept
The concept is to use Doctrine DBAL as an additional database abstraction layer. The code of the DBAL Drupal database driver is meant to be 'database agnostic', i.e. the driver should be able to execute on any db platform that DBAL supports (in theory, practically there still need to be db-platform specific hacks through the concept of DBAL extensions, see below).
The Drupal database Connection
class that this driver implements opens
a DBAL\Connection
, and hands over statements' execution to it.
DBAL\Connection
itself wraps a lower level driver connection (PDO
for pdo_mysql and pdo_sqlite drivers, mysqli
for the mysqli driver).
Similarly, the StatementWrapper
wraps a DBAL\Statement
, which itself
wraps a DBAL-driver level Statement
.
The DBAL connection provides additional features like the Schema Manager
that can introspect a database schema and build DDL statements, a Query
Builder that can build SQL statements based on the database platform in use,
etc. etc.
To overcome DBAL limitations and/or fit Drupal specifics, the DBAL Drupal
database driver also instantiates an additional object called
DBALExtension
, unique for the DBAL Driver in use, to which some
operations that are db- or Drupal-specific are delegated.
Status
The code in the master
branch is working on a MySql database, using
either the 'mysql' or the 'mysqli' DBAL drivers, on a SQlite database, using
the 'sqlite' DBAL driver, or on a Oracle database using the 'oci8' database
driver.
'Working' means:
- it is possible to install a Drupal site via the installer, selecting 'Doctrine DBAL' as the database of choice;
- it is passing a selection of core PHPUnit tests , executed on GitHub Actions CI. The latest patches for the issues listed in 'Related Drupal issues' below need to be applied to get a clean test run.
Installation
Very rough instructions to install Drupal from scratch with this db driver under the hood:
- Get the DruDbal module from Packagist via Composer, it will install Doctrine DBAL as well:
$ composer require mondrake/drudbal:dev-master
- Launch the interactive installer. Proceed as usual and when on the db selection form, select 'Doctrine DBAL' and enter a 'database URL' compliant with Doctrine DBAL syntax. Note: the driver works only with mysql, mysqli, oci8 or sqlite DBAL drivers.
- If everything goes right, when you're welcomed to the new Drupal installation, visit the Status Report. The 'database' section will report something like: