Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ORM3 compatibility#421

Merged
derrabus merged 3 commits into
beberlei:masterfrom
connorhu:feature/orm3
Feb 29, 2024
Merged

ORM3 compatibility#421
derrabus merged 3 commits into
beberlei:masterfrom
connorhu:feature/orm3

Conversation

@connorhu
Copy link
Copy Markdown
Contributor

No description provided.

@connorhu connorhu force-pushed the feature/orm3 branch 2 times, most recently from 5a7205e to bc0f53c Compare January 24, 2024 01:14
Copy link
Copy Markdown
Collaborator

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

Thank you for starting the work on this topic. I get the impression that you're trying to cover multiple topic at once. Try to keep your PR focused. For instance, dropping PHP 7 support or upgrading PHP CS Fixer should be separate PRs.

Comment thread composer.json
Comment thread composer.json Outdated
Comment thread composer.json Outdated
Comment thread .github/workflows/tests.yml
Comment thread src/Query/AbstractCryptParser.php Outdated
@connorhu connorhu force-pushed the feature/orm3 branch 2 times, most recently from b06e4f7 to daaa858 Compare January 26, 2024 13:17
@beberlei
Copy link
Copy Markdown
Owner

@connorhu ah, i merged a PR that does some improvements to Lexer compatibility already causing a few conflicts here. Can you integrate it or is that problematic?

@connorhu
Copy link
Copy Markdown
Contributor Author

connorhu commented Jan 26, 2024

@connorhu ah, i merged a PR that does some improvements to Lexer compatibility already causing a few conflicts here. Can you integrate it or is that problematic?

@beberlei Sure, I can integrate it, because I've done those conversions too. There are still some open questions around code simplification, whether it makes sense or not, whether I should do it or not. I can make a table showing how much repetitive logic is in the code.

Comment thread composer.json Outdated
Comment thread composer.json Outdated
Comment thread src/Query/Mysql/Acos.php Outdated
@connorhu connorhu force-pushed the feature/orm3 branch 2 times, most recently from 667230f to c7e89ff Compare February 5, 2024 13:50
Comment thread src/Query/Mysql/AnyValue.php Outdated
Comment thread src/Types/ZendDateType.php Outdated
Comment thread tests/Query/DbTestCase.php Outdated
Comment thread tests/Query/DbTestCase.php Outdated
Comment thread tests/Query/DbTestCase.php Outdated
Comment thread tests/Query/Mysql/DateTest.php Outdated
@connorhu connorhu force-pushed the feature/orm3 branch 4 times, most recently from 63f31a9 to 55ef25e Compare February 5, 2024 18:54
@connorhu connorhu marked this pull request as ready for review February 5, 2024 18:56
Comment thread .github/workflows/orm2_tests.yml Outdated
Comment thread src/Types/CarbonDateTimeType.php Outdated
Comment thread tests/Query/DbTestCase.php Outdated
Comment thread tests/Query/Mysql/TrigTest.php
@derrabus
Copy link
Copy Markdown
Collaborator

derrabus commented Feb 5, 2024

Please revert the changes you've made to the CI. We don't need them.

@derrabus
Copy link
Copy Markdown
Collaborator

derrabus commented Feb 7, 2024

Whenever you have time:

  • Please make PHPCS happy.
  • Please revert everything in the .github directory.
  • Please answer the remaining open question.

@connorhu
Copy link
Copy Markdown
Contributor Author

connorhu commented Feb 8, 2024

To answer your question I have to figure out whats going on here with the carbon.

The types for Carbon were extend from DateType, and some versions did not run tests when combined. This could also mean that 1) some versions didn't work at all, just weren't tested, 2) it would be better to extend the Type class instead 3) the testing is too permissive/incorrect.

@connorhu
Copy link
Copy Markdown
Contributor Author

connorhu commented Feb 8, 2024

Current implementation is not compatible with DBAL4.
When convertToDatabaseValue method of TimeType, DateType etc classes with DBAL<4 converts the value, it uses DateTimeInterface to check the type.
With DBAL4 it checks for DateTime.
DBA3:
https://github.com/doctrine/dbal/blob/de57e23f00c513263df93b9b10bbbb421bc9239f/src/Types/DateType.php#L49
DBAL4:
https://github.com/doctrine/dbal/blob/1a307d92f8531b0897176e95040051c7414d80a5/src/Types/DateType.php#L38

The problem here is that CarbonImmutable* types do not extend immutable DBAL types. If I fix this, then 4 tests still won't run because they try to save an Immutable type in an non Immutable field:

$entity->date = CarbonImmutable::createFromDate(2015, 1, 1);

If we want these 4 tests to run, we need our own convertToDatabaseValue implementation.

@connorhu
Copy link
Copy Markdown
Contributor Author

connorhu commented Feb 9, 2024

PR rebased, squasd into one commit. Now we have to wait for release ORM 2.19.0.

Comment thread composer.json Outdated
Co-authored-by: Alexander M. Turek <[email protected]>
@derrabus
Copy link
Copy Markdown
Collaborator

derrabus commented Feb 9, 2024

Yes. Thank you very much!

@connorhu
Copy link
Copy Markdown
Contributor Author

connorhu commented Feb 9, 2024

Thank you for helping the process.

Comment thread tests/Entities/ZendDate.php Outdated
Co-authored-by: Théo Attali <[email protected]>
@Cool-Programmer

This comment was marked as off-topic.

@connorhu

This comment was marked as off-topic.

@derrabus

This comment was marked as off-topic.

@Cool-Programmer

This comment was marked as off-topic.

@connorhu

This comment was marked as off-topic.

@derrabus

This comment was marked as off-topic.

@abozhinov
Copy link
Copy Markdown

When to expect the new release?

@derrabus
Copy link
Copy Markdown
Collaborator

When it's ready.

@connorhu
Copy link
Copy Markdown
Contributor Author

connorhu commented Feb 29, 2024

@derrabus I was thinking. It is a legitimate wish to use the code with orm3. Which is ready anyway. What if you make an orm3 branch, apply the contents of this PR as a patch, rewrite the requirement for orm3 only and put a note in the install description that until 2.19 is released, the ORM3 compatible code is there? If 2.19 is released, we will merge this PR, drop the orm3 branch and leave the master only.

@derrabus
Copy link
Copy Markdown
Collaborator

I mean, we can merge the branch as is. It's ready anyway and Composer will take care that this package is not installed with ORM 2.18.

@derrabus derrabus changed the title orm3 compatibility ORM3 compatibility Feb 29, 2024
@derrabus derrabus merged commit e1b95aa into beberlei:master Feb 29, 2024
@derrabus
Copy link
Copy Markdown
Collaborator

Ah well, we should've done a rebase before, to have PHPStan analyze your changes. I've pushed b6349f3 in order to make the CI green.

@connorhu connorhu deleted the feature/orm3 branch February 29, 2024 16:11
@Chris53897
Copy link
Copy Markdown
Contributor

Thanks. But we should not forget to remove the @dev after the stable release of doctrine/orm 2.19.
https://github.com/beberlei/DoctrineExtensions/blob/master/composer.json#L13

@derrabus
Copy link
Copy Markdown
Collaborator

derrabus commented Mar 2, 2024

Sure. Not that it has any impact downstream, but we will remove it.

@derrabus
Copy link
Copy Markdown
Collaborator

derrabus commented Mar 3, 2024

https://github.com/beberlei/DoctrineExtensions/releases/tag/v1.5.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants