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

!!! FEATURE: update to doctrine/dbal version 3 #2637

Merged
merged 37 commits into from
Jul 11, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 29, 2021

update to doctrine/dbal version 3

  • doctrines json_array type is deprecated, therefore flow_json_array is based off of json type now
  • We use PSR6 caches now instead of the deprecated doctrine cache implementation
  • New Cache Flow_Persistence_Doctrine_Metadata for ORM class metadata
  • Repository::findAllIterator directly returns an iterable, the Repository::iterate method is gone
  • All doctrine migration commands have a new optional migration-folder argument that allows to overwrite the "platform name part" in migration resolving (e.g. "Mysql") as the resolving changed and we cannot be sure deducing it from the current connection will work long term for all cases. Currently MySQL/MariaDB (map to "Mysql"), PostgreSQL (maps to "Postgresql" and SQLite (maps to "Sqlite") all work fine automatically still.

Related Neos adjustments: neos/neos-development-collection#5161

Upgrade instructions

We require now version 3 of doctrine/dbal but still operate doctrine/orm in version 2.
In case you depend on DBAL directly you should have a look into their upgrade instructions: https://www.doctrine-project.org/2020/11/17/dbal-3.0.0.html

@albe albe changed the title Update doctrine/dbal requirement from ^2.13 to ^3.2 TASK: Update doctrine dependencies Apr 4, 2022
@kdambekalns
Copy link
Member

It seems something is wrong with the (expected) PhpUnit version, and that ping() call missing an argument looks interesting, too…

@kdambekalns kdambekalns self-requested a review April 4, 2022 15:54
@albe
Copy link
Member

albe commented Apr 4, 2022

Ugh, okay, I need to continue this with a clear head at another time - ping() is a method of the AllowedObjectsListener and not the PersistenceManager...

@albe albe self-assigned this Apr 5, 2022
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

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

Any news, @albe?

@dependabot dependabot bot changed the base branch from 8.2 to 8.3 November 30, 2022 16:55
@mhsdesign mhsdesign changed the title TASK: Update doctrine dependencies FEATURE: update to doctrine/dbal version 3 Jan 15, 2024
@mhsdesign mhsdesign force-pushed the dependabot/composer/doctrine/dbal-tw-3.2 branch from 8b4723e to ec0969f Compare January 15, 2024 19:25
@mhsdesign mhsdesign changed the base branch from 8.3 to 9.0 January 15, 2024 19:25
@github-actions github-actions bot added 9.0 and removed 8.3 labels Jan 15, 2024
@mhsdesign
Copy link
Member

Rebased on 9.0 so this can be continued but i dont actually what our plan is with all this doctrine stuff

// cc @bwaidelich @kitsunet

@neos neos deleted a comment from dependabot bot Jan 15, 2024
@kitsunet
Copy link
Member

kitsunet commented Jul 7, 2024

Still many deprecations to tackle though

@kitsunet
Copy link
Member

kitsunet commented Jul 8, 2024

See #3379

@kitsunet
Copy link
Member

kitsunet commented Jul 9, 2024

There is still two open points.
Logging works differently now and I need to create a driver middleware to enable it without deprecation and

the whole Platform->getName() deprecation as we use the name currently to generate the folder name for migrations. We would now have to produce it from the classname which can be more specialised (e.g. \Doctrine\DBAL\Platforms\MariaDb1060Platform) Karsten and me talked about a Settings mapping of platform classes to folder name, alternative would be to try if exists and fallback the whole class hierarchy (ala MariaDb1060Platform -> MariaDb1052Platform -> MariaDb1043Platform -> MariaDb1027Platform -> MariaDBPlatform -> MySQLPlatform -> AbstractMySQLPlatform to show a worst case example) drawback is checking A LOT of folders potentially and also if doctrine changes the class hierarchy that might influence or migrations. So settings seems safer....

@bwaidelich
Copy link
Member

bwaidelich commented Jul 9, 2024

the whole Platform->getName() deprecation as we use the name currently to generate the folder name for migrations
a Settings mapping of platform classes to folder name

Mh, another configuration option that might get outdated as new db versions are used.
Couldn't we just hard-code the common cases, and possibly allow the folder name to be specified as fallback:

       $folderName = match (true) {
           $platform instanceof MySQLPlatform => 'Mysql',
           $platform instanceof PostgreSQLPlatform => 'Posgresql',
           $platform instanceof SqlitePlatform => 'Sqlite',
           default => throw new \InvalidArgumentException(sprintf('Failed to determine migration folder name from platform "%s". Please specify --folder-name', get_debug_type($platform))),
       };

see https://3v4l.org/eDuvo#v8.2.7

@kitsunet
Copy link
Member

kitsunet commented Jul 9, 2024

Yep what you hardcoded woudl roughly how I thought about the setting, just those 3, but I would be fine to do it like this with the folder name option. Not that this whole migration system is hugely extensible / will be used elsewhere.

@kitsunet
Copy link
Member

kitsunet commented Jul 9, 2024

Let's go with that IMHO, pragmatic and should cover all cases... I like it, thanks @bwaidelich

@kitsunet
Copy link
Member

kitsunet commented Jul 9, 2024

Alright, migrations down, logging to go...

@kitsunet
Copy link
Member

kitsunet commented Jul 9, 2024

Aaaand logging covered.

@kitsunet
Copy link
Member

Alright I call this done for now, technically I have 2 approvals, but stuff has changed since then....

@kdambekalns
Copy link
Member

Alright I call this done for now, technically I have 2 approvals, but stuff has changed since then....

I had another look… sorry! 😇

@kitsunet
Copy link
Member

kitsunet commented Jul 11, 2024

Alright I call this done for now, technically I have 2 approvals, but stuff has changed since then....

I had another look… sorry! 😇

No very good, it was late! We definitely used too many different variants of these name comparisons between double and single quotes and strict and loose comparison ^^

@kdambekalns
Copy link
Member

We definitely used too many different variants of these name comparisons

I think we all just used what Doctrine generated, and that changed over time… 🤷‍♂️

@kitsunet kitsunet merged commit 1d54ec0 into 9.0 Jul 11, 2024
9 checks passed
@kitsunet kitsunet deleted the dependabot/composer/doctrine/dbal-tw-3.2 branch July 11, 2024 11:48
@@ -142,51 +136,23 @@ public function findAll(): QueryResultInterface
/**
* Find all objects and return an IterableResult
Copy link
Member

Choose a reason for hiding this comment

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

btw no IterableResult here *g

but i was actually wondering .. what is the benefit here of using this vs findAll? isnt findAll an iterator as well??? I mean we can keep it for b/c ... but i dont know if we need to use it in neos?

Copy link
Member

Choose a reason for hiding this comment

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

That depends I guess worth a look at the source, but findAll would return a full array, woudln't it? While this here can be optimized at the driver level to stream the results as single chunks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants