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

DDC-3822: Nullable embeddables [Feature Request] #4670

Closed
doctrinebot opened this issue Jul 13, 2015 · 2 comments
Closed

DDC-3822: Nullable embeddables [Feature Request] #4670

doctrinebot opened this issue Jul 13, 2015 · 2 comments

Comments

@doctrinebot
Copy link

Jira issue originally created by user dadamssg:

I've noticed that when using embeddables that they are always created in the entity not matter what. For example, a User has a PhoneNumber(embeddable) and the PhoneNumber only has one field, "value". If it's reasonable for a User to not have a PhoneNumber in the system, then I don't believe a PhoneNumber instance should be created for the User entity when hydrated. If the value object's class has a **toString() method then you are forced to check if the value is null and if it is then return an empty string which is very hacky.

I propose to add a new "nullable" option to embeddables. If all of the columns that make up the embedded object are null then the embedded object should not be created if "nullable" is set to true.

Here's a gist illustrating the problem and the possible solution in yml.

https://gist.github.com/dadamssg/25714381e97220147ce2

@ruudk
Copy link
Contributor

ruudk commented Jan 6, 2016

+1

@deeky666
Copy link
Member

deeky666 commented Jan 6, 2016

Duplicate of #4568

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

No branches or pull requests

4 participants