Skip to content

Doctrine ORM 2: readonly entity properties fail with the legacy proxies #166

Closed

Description

@njoubert-cleverage

Description

composer.json allows doctrine/orm ^2.20 || ^3.5, but the entities have readonly properties since v3.2: ProcessExecution::$code, $startDate, $logFilename, and LogRecord::$channel, $level, $message, $context, $createdAt, $processExecution.

With Doctrine ORM 2 and its legacy proxies (doctrine/common proxy generator, i.e. DoctrineBundle 2 without doctrine.orm.enable_lazy_ghost_objects: true), creating a proxy of these entities fails, e.g. when a LogRecord is loaded with its processExecution relation:

Cannot unset readonly property CleverAge\UiProcessBundle\Entity\ProcessExecution::$code
from scope Proxies\__CG__\CleverAge\UiProcessBundle\Entity\ProcessExecution

Found by the lowest dependencies CI job of #164 (PR #165): requiring the PHP polyfills made --prefer-lowest resolve doctrine/orm 2.20.0 instead of 3.6.0, and 2 tests of LogRecordCrudTest failed. The test kernel now enables the lazy ghost objects on ORM 2 (tests/App/TestKernel.php, as the DoctrineBundle 2 Symfony recipe does), but an application on ORM 2 without this setting gets the error (log records list, execution details...).

Proposed fix

Two options, to decide:

  1. Keep ORM 2 support: document the requirement (doctrine.orm.enable_lazy_ghost_objects: true with ORM 2, set by the Symfony recipe of DoctrineBundle 2.x) in the installation documentation, and fail early with an explicit message, e.g. a check when the container is compiled (ORM 2 detected and lazy ghost objects disabled), instead of the PHP error at runtime.
  2. Drop ORM 2: require doctrine/orm ^3.5 (ORM 2 only gets security fixes), remove the test kernel workaround and simplify the CI matrix. This is a dependency change: applications still on ORM 2 must stay on ui-process-bundle 3.2 or upgrade Doctrine.

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

Option 1: none. Option 2: applications on Doctrine ORM 2 can no longer install the next version (to be released in a minor version only if considered acceptable, since ORM 2 setups without lazy ghost objects are already broken since v3.2; otherwise in the next major).

Activity

  1. added a commit that references this issue on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions