Doctrine SQL Server uniqueidentifier isn't cast as char or nvarchar when retrieved from the database
Posted
by Tres
on Stack Overflow
See other posts from Stack Overflow
or by Tres
Published on 2010-05-04T05:43:30Z
Indexed on
2010/05/04
10:58 UTC
Read the original article
Hit count: 229
When I retrieve a record from the database which has a column of type "uniqueidentifier", Doctrine fills it with "null" rather than the unique id from the database.
Some research and testing has brought this down to a PDO/dblib driver issue. When directly querying via PDO, null is returned in place of the unique id.
For reference, http://trac.doctrine-project.org/ticket/1096, has a bit on this, however, it was updated 11 months ago with no comment for resolution.
A way around this, as mentioned at http://bugs.php.net/bug.php?id=24752&edit=1, is to cast the column as a char. However, it doesn't seem Doctrine exposes the native field type outside of generating models which makes it a bit hard to detect uniqueidentifier types and cast them internally when building the sql query.
Has anyone found a workaround for this?
© Stack Overflow or respective owner