-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ORM 3.0 compat #2708
Comments
There are a few things that are coming up fairly regularly:
/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php:132
/src/Tree/Strategy/ORM/Closure.php:462
/src/Tree/Strategy/ORM/Closure.php:286
/src/Tree/TreeListener.php:247 And this is on top of the removal of the annotation and YAML mapping drivers, which a lot of the tests use. |
main...mbabker:DoctrineExtensions:orm-3-merge has a branch with a lot of small things chipped away at. A few of the commits are merges from other PRs, a few are new things tackled today which can be extracted out later. Big things listed earlier still apply for the most part (more may be hidden since a fair number of tests are currently skipped on that branch as they rely on annotation and YAML mapping support), as well as the XML validation issue from #2613 now being a bigger thing. |
In that catch-all branch, I've got the
|
With the tests run against the ORM 3.0 RC, we're down to:
1) Gedmo\Tests\Sluggable\Issue\Issue104Test::testShouldThrowAnExceptionWhenMappedSuperclassProtectedProperty
Failed asserting that exception of type "Doctrine\ORM\Mapping\MappingException" matches expected exception "Gedmo\Exception\InvalidMappingException". Message was: "Duplicate definition of column 'title' on entity 'Gedmo\Tests\Sluggable\Fixture\Issue104\Car' in a field or discriminator column mapping." at
vendor/doctrine/orm/src/Mapping/MappingException.php:420
vendor/doctrine/orm/src/Mapping/ClassMetadata.php:1191
vendor/doctrine/orm/src/Mapping/ClassMetadata.php:1882
vendor/doctrine/orm/src/Mapping/Driver/AttributeDriver.php:334
vendor/doctrine/orm/src/Mapping/ClassMetadataFactory.php:163
vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php:343
vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php:225
vendor/doctrine/orm/src/EntityManager.php:216
tests/Gedmo/Tool/BaseTestCaseORM.php:66
tests/Gedmo/Tool/BaseTestCaseORM.php:66
tests/Gedmo/Sluggable/Issue/Issue104Test.php:34 |
We've got the stable release out, now. I truthfully don't know what to do with the errors around src/Mapping/Event/Adapter/ORM.php:179
src/Translatable/TranslatableListener.php:756
src/Translatable/TranslatableListener.php:432 src/Tree/Strategy/ORM/Nested.php:161
src/Tree/TreeListener.php:165 For the nested tree strategy, it uses the |
I am using TimestampableEntity, and update from ORM v2 to v3:
|
ORM 3.0 does not support annotations anymore, you will need to update your mapping to use attributes. |
I've tried to take a look at the usage in the |
For the sake of moving things forward, I've just replaced the The 57 errors around the removal of TypeError: Doctrine\DBAL\Types\StringType::getSQLDeclaration(): Argument #1 ($column) must be of type array, Doctrine\ORM\Mapping\FieldMapping given, called in src/Translatable/Query/TreeWalker/TranslationWalker.php on line 324
vendor/doctrine/dbal/src/Types/StringType.php:15
src/Translatable/Query/TreeWalker/TranslationWalker.php:324
src/Translatable/Query/TreeWalker/TranslationWalker.php:129
vendor/doctrine/orm/src/Query/Parser.php:342
vendor/doctrine/orm/src/Query.php:216
vendor/doctrine/orm/src/Query.php:245
[...] This one would be from doctrine/orm#10607 with the ORM in 3.0 using more DTOs and less arrays. Except, in this case, the mapping info can no longer be passed directly into the DBAL since |
I guess casting the object to array |
Added the typecast to my branch, then skipped the test where the mapping exceptions are different since there looks to be a change between 2.x and 3.x and the test won't fail inside our code anymore. That just leaves one erroring test on the branch, then working out porting it all over in a B/C manner (since I've only been running the tests locally on that branch with ORM 3.0 installed): 1) Gedmo\Tests\Sluggable\SluggableIdentifierTest::testShouldPersistMultipleNonConflictingIdentifierSlugs
Doctrine\ORM\Exception\EntityIdentityCollisionException: While adding an entity of class Gedmo\Tests\Sluggable\Fixture\Identifier with an ID hash of "__id__" to the identity map,
another object of class Gedmo\Tests\Sluggable\Fixture\Identifier was already present for the same ID. This exception
is a safeguard against an internal inconsistency - IDs should uniquely map to
entity object instances. This problem may occur if:
- you use application-provided IDs and reuse ID values;
- database-provided IDs are reassigned after truncating the database without
clearing the EntityManager;
- you might have been using EntityManager#getReference() to create a reference
for a nonexistent ID that was subsequently (by the RDBMS) assigned to another
entity.
Otherwise, it might be an ORM-internal inconsistency, please report it.
vendor/doctrine/orm/src/Exception/EntityIdentityCollisionException.php:15
vendor/doctrine/orm/src/UnitOfWork.php:1540
vendor/doctrine/orm/src/UnitOfWork.php:1386
vendor/doctrine/orm/src/UnitOfWork.php:932
vendor/doctrine/orm/src/UnitOfWork.php:1805
vendor/doctrine/orm/src/UnitOfWork.php:1763
vendor/doctrine/orm/src/EntityManager.php:435
tests/Gedmo/Sluggable/SluggableIdentifierTest.php:56 This one's the fun one. The sluggable listener's |
@mbabker could you please elaborate on that? I have the same problem with Translatable:
I use Symfony 6.4 with attributes. Thanks. |
It is just as I said, ORM 3.0 removed support for annotations. Compare the As this library does not yet support ORM 3.0, you will need to downgrade to ORM 2.x until compatibility is finished. |
@mbabker Thanks for all your work to support orm v3. I guess it is one part to allow fresh installs with support of orm v3. |
Test pull requests, test the branch I linked earlier that has the raw changes I've done to get the test suite to pass with only ORM 3 running. A lot of the needed code changes are there now, it's mostly just working back through them to apply them in a B/C friendly way.
That's #2502 and it's a DBAL 4.0 blocker. |
For a fresh Symfony7 project this way of downgrading worked for me:
Then run |
For a fresh Symfony7, downgrade also:
|
@mbabker did a great job adding support for ORM 3 ❤️ and now it's merged in the |
Working nicely 👍 |
I just use Blameable and Logable. This works fine.
|
I can confirm that SoftDeleteable works for entities and documents. |
I can confirm |
Closing here since there is a new release https://github.com/doctrine-extensions/DoctrineExtensions/releases/tag/v3.16.0 thanks everybody for trying and thanks @mbabker again! |
I am confused, the errors regarding annotations are still present with the release of
Those annotations are in the traits provided by |
@alcohol I had the same issue. Remove all |
Why would I do that? My composer dependencies are not the issue here. |
Then, don't even do what I wrote. |
Adding |
You can add this line somewhere in your bootstrapping code, too, instead of needing to add an ignore annotation in every file: AnnotationReader::addGlobalIgnoredNamespace('Doctrine\ORM\Mapping'); It's needed in the test bootstrap for this package, too. Without dropping annotations mapping support entirely, there isn't a clean way to get around the need for that line if your application is using ORM 3 and has the Annotations library installed. For B/C, the feature detection code inside this library will try to use annotations when no explicit reader (either the Doctrine annotation reader or this package's attribute reader) is set and the Annotations library is installed. I know there's a recent PR in the bundle to inject the attribute reader in some cases, I don't remember if that's in a tagged release yet. |
The ORM now has a 3.0 beta release so it's probably time to start looking at that upgrade guide.
The text was updated successfully, but these errors were encountered: