Upgrade to newer version breaks API using Enums #7012

Closed
opened 2026-01-22 15:43:08 +01:00 by admin · 2 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.
admin closed this issue 2026-01-22 15:43:08 +01:00
Author
Owner

@derrabus commented on GitHub (Jul 20, 2022):

Was the previous behavior actually desirable? It was considered a bug and therefore fixed.

@derrabus commented on GitHub (Jul 20, 2022): Was the previous behavior actually desirable? It was considered a bug and therefore fixed.
Author
Owner

@beberlei commented on GitHub (Jul 21, 2022):

Yes previous behavior was a bug

@beberlei commented on GitHub (Jul 21, 2022): Yes previous behavior was a bug
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7012