Version attribute does not work when column type is inferred instead of explicitly given #7276

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

Originally created by @cttboehme on GitHub (Dec 7, 2023).

Bug Report

Q A
BC Break no
Version 2.17.1

Summary

If the #[Version] attribute is specified a column that has no explicitly given type but rather has its type inferred from the respective PHP type, an error occurs.

Current behavior

With the above condition, the follow error occurs:

ErrorHandler: Doctrine\ORM\Mapping\MappingException: Locking type "" (specified in "path1\path2\xxxx", field "version") is not supported by Doctrine

How to reproduce

  1. Have the versioned column infer the column type from the respective PHP field (eg. private int $version;)
  2. Use the entity

Expected behavior

The version attribute should work irrespective of how the column type is specified

Originally created by @cttboehme on GitHub (Dec 7, 2023). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | no | Version | 2.17.1 #### Summary <!-- Provide a summary describing the problem you are experiencing. --> If the `#[Version]` attribute is specified a column that has no explicitly given type but rather has its type inferred from the respective PHP type, an error occurs. #### Current behavior With the above condition, the follow error occurs: `ErrorHandler: Doctrine\ORM\Mapping\MappingException: Locking type "" (specified in "path1\path2\xxxx", field "version") is not supported by Doctrine` #### How to reproduce <!-- Provide steps to reproduce the bug. If possible, also add a code snippet with relevant configuration, entity mappings, DQL etc. Adding a failing Unit or Functional Test would help us a lot - you can submit one in a Pull Request separately, referencing this bug report. --> 1. Have the versioned column infer the column type from the respective PHP field (eg. `private int $version;`) 2. Use the entity #### Expected behavior <!-- What was the expected (correct) behavior? --> The version attribute should work irrespective of how the column type is specified
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7276