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

json_array columns should return null for null values #655

Closed
wants to merge 1 commit into from
Closed

json_array columns should return null for null values #655

wants to merge 1 commit into from

Conversation

wildlyinaccurate
Copy link

I guess this is a BC-break, but it fixes DBAL-446.

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-966

We use Jira to track the state of pull requests and the versions they got
included in.

@Ocramius
Copy link
Member

Ocramius commented Aug 6, 2014

Can't accept this bc break in 2.x, sorry.

@Ocramius Ocramius closed this Aug 6, 2014
@wildlyinaccurate
Copy link
Author

That sucks, since it was marked as resolved in 2.3.3... What's the workaround then, a custom data type?

@Ocramius
Copy link
Member

Ocramius commented Aug 6, 2014

@wildlyinaccurate yep, for now, that's the solution :-\

@Ocramius Ocramius self-assigned this Aug 6, 2014
@deeky666
Copy link
Member

deeky666 commented Aug 6, 2014

@wildlyinaccurate it is marked as resolved in 2.3.3 indeed but if you have a look at JsonArrayType in the 2.3.3 tag you will notice that the behaviours was the same as it is now. It still returns array() instead of null. As we unfortunately don't have a reference commit, I assume this was a misunderstanding of some kind.

@frickenate
Copy link

Could we maybe get an additional "json" or "json_object" type? "json_array" is a poor name to begin with, as we can store non-array data as well. You can store a boolean, integer, float, or string just fine in a json_array column. The only problem is that when this type was added, the assumption was made that people would only use this to store arrays. I have a config-based table where the value column should be json, yet I can't use json_array because of this null bug. I guess I'm off to figure out my first custom type.

@Ocramius
Copy link
Member

I guess I'm off to figure out my first custom type.

I'd suggest the same as well: if we introduce a new json type now, then it's just going to be even more messy

@frickenate
Copy link

For the next person to come here looking for answers, I've posted a blog entry with the custom Json data type.

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

Successfully merging this pull request may close these issues.

None yet

5 participants