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

Convert generated id value to its PHP representation. #6020

Closed

Conversation

renan
Copy link
Contributor

@renan renan commented Sep 11, 2016

This makes it possible for post-insert ids to be converted into a custom object as it happens for any other identity strategy.

According to the conversion rules of a specific DBAL mapping type.

According to the conversion rules of a specific DBAL mapping type.
@lcobucci
Copy link
Member

@renan I'm not sure what's @Ocramius opinion here but I'd say that I don't think that the ORM should be responsible for that.

Auto generated ids are DB-dependent and wouldn't make sense to have them converted to custom objects. IMHO it's an edge case and if you really need/want to do that you can override ClassMetadata#setIdentifierValues() and do the conversion there.

@renan
Copy link
Contributor Author

renan commented Nov 24, 2016

The ORM/DBAL offers a feature that can convert any given column to a different, including custom, object type. Said feature is documented here.

Currently loading/hydrating an entity that have a custom object type mapped for an auto-generated id will work as expected: converting any value to the mapped type.
What is missing is converting such value to the mapped type after a given entity is newly persisted. Again, saving an existing entity, or loading the entity, will also work as expected.

Hence I respectfully disagree, and argue this might even be a bug.

@Ocramius
Copy link
Member

This does indeed look like a bug. Can't check the code right now, but labeling it.

@Ocramius
Copy link
Member

@renan this was handled in #6152. Tests from here were ported there as well, thanks!

@renan renan deleted the bugfix/convert-generated-id-to-type branch December 8, 2016 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants