Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31088: Refactored Content GW to use Doctrine\DBAL #2845

Conversation

alongosz
Copy link
Member

@alongosz alongosz commented Oct 29, 2019

Question Answer
JIRA issue EZP-31088 blocking EZP-30921
Requires #2843
Bug/Improvement yes
New feature no
Target version master (8.0@dev) for eZ Platform v3.0
BC breaks no
Tests pass yes
Doc needed no

This PR refactors the Legacy Content Gateway implementation (\eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase) to rely on \Doctrine\DBAL\Connection instead of our custom Database Handler.

Shared Gateway

The tables in our schema: ezcontentobject_attribute, ezcontentclass, and ezcontentclass_attribute have composite primary key with an auto-increment, which is not supported by SQLite3. Therefore, similar to this hack I've introduced Shared gateway, meant to be injected into various gateways, if needed. It creates in-memory sequence for SQLite. I decided not to differentiate this operation based on table name as the impact is rather minimal (SQLite is used for integration tests due to its good performance and setup simplicity).

At the same time I've dropped generating sequence name from table and column name in favor of literal constants defined for proper gateways. The reasoning behind this is that sequence is a unique database object, in the same way as tables/relations.

Implemented via d6a9984dd5b7d6d0a0b4d359c045bcaece6f2b94.

QA

  • Sanity checks for Content listing, viewing, and mutation.

TODO:

@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch 2 times, most recently from 6826b1b to 7b83852 Compare October 30, 2019 15:49
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch 2 times, most recently from 52a2429 to efd7821 Compare November 13, 2019 13:35
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch from efd7821 to 063aa4a Compare December 2, 2019 16:09
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch from 063aa4a to 64c8555 Compare January 10, 2020 11:51
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch from 64c8555 to 6571286 Compare January 17, 2020 17:25
@alongosz alongosz marked this pull request as ready for review January 17, 2020 18:44
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch from 6571286 to 766d64c Compare January 17, 2020 19:36
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch 2 times, most recently from d41ffc5 to c9dce64 Compare January 27, 2020 13:38
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch from c9dce64 to e5a0f64 Compare March 4, 2020 13:06
alongosz added 20 commits March 16, 2020 10:20
The *::getContext methods were used as a workaround for lack of
dependency injection.
* Implemented Gateway Factory to obtain a Gateway for a specific database platform.

* Implemented SQLite and Fallback shared Gateways.

* Implemented Gateway::getColumnNextIntegerValue method.

* Defined Gateway in the Symfony DIC configuration.
* Introduced strict types
* Aligned PHPDoc (not required for strict types)
* Aligned code style
* Marked Legacy\Content\Gateway\DoctrineDatabase class as final and internal
* Marked Legacy\Content\Gateway\DoctrineDatabase\QueryBuilder class as final and internal
* Marked Legacy\Content\Gateway\ExceptionConversion class as final and internal
Gateways are intended for internal use by the Legacy Storage and should not be injected by external packages.
* Dropped no longer needed createVersionInfoQueryBuilder
We assume that integer returned for insert methods is well understood as a new ID generated by a database
@alongosz alongosz force-pushed the ezp-31088-replace-content-gw-dbh-with-doctrine branch from 0f735c0 to 5c18cab Compare March 16, 2020 09:22
Copy link

@tomaszszopinski tomaszszopinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Approved on eZ Platform EE v3.0 master with diff.

@alongosz alongosz merged commit 511d0ae into ezsystems:master Mar 16, 2020
@alongosz alongosz deleted the ezp-31088-replace-content-gw-dbh-with-doctrine branch March 16, 2020 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants