Doctrine Mssql uniqueidentifier isn't cast as char or nvarchar when retrieved from the database.
- by Tres
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?