Skip to content
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

Allow all datetime types to be used as version #7558

Conversation

nico-incubiq
Copy link

Replaces #7554


I am working on an existing database with fields of type timestamp. In order to map that to a DateTime object in Doctrine, I've found the solution of adding the @Version annotation. But I'd really prefer to get a DateTimeImmutable, which is impossible.

At the moment a field of type datetime_immutable with annotation @Version will trigger this following error:

Locking type "datetime_immutable" (specified in "App\Entity\Bakery", field "createdAt") is not supported by Doctrine.
I cannot see any reason not to allow any type of datetime to be mapped to a timestamp in database, so this PR allows all of them. Please tell me if i'm missing something.

@Ocramius Ocramius self-assigned this Jan 5, 2019
@Ocramius Ocramius added this to the 3.0 milestone Jan 5, 2019
@Ocramius
Copy link
Member

Ocramius commented Jan 5, 2019

🚢 thanks @nico-incubiq!

@Ocramius Ocramius merged commit 22bf778 into doctrine:master Jan 5, 2019
@greg0ire greg0ire removed this from the 3.0.0 milestone Jun 27, 2021
@yethee
Copy link
Contributor

yethee commented Apr 24, 2024

The PR has the merged status, but the datetime_immutable type is not supported in the latest versions. Changes reverted for some reasons?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants