Upgrade to newer version breaks API using Enums #7010

Open
opened 2026-01-22 15:43:05 +01:00 by admin · 0 comments
Owner

Originally created by @alexander-schranz on GitHub (Jul 20, 2022).

BC Break Report

  - Upgrading doctrine/dbal (3.3.5 => 3.3.7): Extracting archive
  - Upgrading doctrine/orm (2.11.2 => 2.12.3): Extracting archive

Summary

I updated our project from the above versions and now the fields using Enum are in:

$queryBuilder->select('invite.id')
    ->addSelect('invite.someEnum')
    ->addSelect('invite.datetime');

return $queryBuilder->getQuery()->toIterable(); // same for getResult()

Previous behavior

The enum did return the enum string not the enum object.

Current behavior

The enum now returns the enum object.

Which ends when being serialized with JMS serializer into and breaks so the APIs:

                 "id": 7,
-                "state": "inactive",
-                "type": "pkpass"
+                "state": {
+                    "name": "INACTIVE",
+                    "value": "inactive"
+                },
+                "type": {
+                    "name": "PKPASS",
+                    "value": "pkpass"
+                }

How to reproduce

Create a field with enum and select it in previous and current version.

Originally created by @alexander-schranz on GitHub (Jul 20, 2022). ### BC Break Report ``` - Upgrading doctrine/dbal (3.3.5 => 3.3.7): Extracting archive - Upgrading doctrine/orm (2.11.2 => 2.12.3): Extracting archive ``` #### Summary I updated our project from the above versions and now the fields using `Enum` are in: ```php $queryBuilder->select('invite.id') ->addSelect('invite.someEnum') ->addSelect('invite.datetime'); return $queryBuilder->getQuery()->toIterable(); // same for getResult() ``` #### Previous behavior The `enum` did return the `enum` string not the enum object. #### Current behavior The `enum` now returns the `enum` object. Which ends when being serialized with JMS serializer into and breaks so the APIs: ```diff "id": 7, - "state": "inactive", - "type": "pkpass" + "state": { + "name": "INACTIVE", + "value": "inactive" + }, + "type": { + "name": "PKPASS", + "value": "pkpass" + } ``` #### How to reproduce Create a field with enum and select it in previous and current version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7010