mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Why won't createNativeQuery return records containing null value? #5407
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dipens on GitHub (Feb 3, 2017).
I have two identical Symfony 2.8 projects. The only difference in these two projects is that one is running Doctrine ORM version
v2.4.8and the other is runningv2.5.5The problem
I have this following piece of code in both Symfony projects.
My Entity looks like this:
In my StoredProcedure all I have is this:
This code works perfectly fine on version
v2.4.8returning me null value perfectly. However this doesn't work onv2.5.5. All it returns is an array with NULL inside it and not thenewPKANDmsgvalue. If I remove the null and replace it with an empty string or anything else for that matter, it works. But for some god forsaken reason, it does not like theNULLvalue. All I want is to check if null is returned or not but I can't seem to check without doctrine returning me proper values.Is there anything that changed between these versions that I am not aware of? What do I need to do in order to read
NULLvalues from a native query?@Ocramius commented on GitHub (Feb 3, 2017):
@dipens are the DBAL versions also different?
@dipens commented on GitHub (Feb 3, 2017):
@Ocramius Yes sorry should have mentioned that. The one with
v2.4.8hasv2.5.4installed. The one withv2.5.5hasv2.5.5installed.@Ocramius commented on GitHub (Feb 4, 2017):
@dipens did you try running this with DBAL only? Did the results change? What DB/adapter are you using?
@dipens commented on GitHub (Feb 7, 2017):
@Ocramius With DBAL I am getting the results. I am using freeTDS on Ubuntu 14.04.
@Ocramius commented on GitHub (Feb 7, 2017):
Ping @deeky665 could our changes in prepared statements in 2.5 affect this?
@deeky666 commented on GitHub (Feb 7, 2017):
@Ocramius the prepared statement stuff was released with
2.5.11, not2.5.5. We'll have to take a look at the differences between DBAL2.5.4and2.5.5if I understand correctly.@Ocramius commented on GitHub (Feb 7, 2017):
@dipens can you try adding a test case meanwhile?
@dipens commented on GitHub (Feb 9, 2017):
@Ocramius Sorry how do I do that?
@Ocramius commented on GitHub (Feb 9, 2017):
See https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket for examples
@dipens commented on GitHub (Aug 17, 2017):
I did a work around with this one using
addScalarResultinstead ofaddFieldResult. The modified code looks like this:@Ocramius commented on GitHub (Aug 17, 2017):
What is the resolution here?
@dipens commented on GitHub (Aug 18, 2017):
I just edited my close comment. Please have a look
@Ocramius commented on GitHub (Aug 18, 2017):
@dipens that still doesn't say much to me - is this therefore a bug? Can it be reproduced?
@potievdev commented on GitHub (Dec 12, 2017):
@Ocramius After upgrading from 2.4 to 2.5 I have the same problem. Late I can send example how reproduce this bug.
@piedrucci commented on GitHub (Dec 25, 2019):
@dipens this one
this one work for me!! thankful....