PHP - Doctrine ORM not able to handle bit(1) types correctly?

buacompliabuy

New Member
UPDATE I have filed a bug in Doctrine about this http://www.doctrine-project.org/jira/browse/DC-400I have the following Doctrine schema:\[code\]---TestTable: columns: bitty: bit(1)\[/code\]I have created the database and table for this. I then have the following PHP code:\[code\]$obj1 = new TestTable();$obj1['bitty'] = b'0';$obj1->save();$obj2 = new TestTable();$obj2['bitty'] = 0;$obj2->save();\[/code\]Clearly my attempt is to save the bit value \[code\]0\[/code\] in the \[code\]bitty\[/code\] column.However after running this PHP code I get the following odd results:\[code\]mysql> select * from test_table;+----+-------+| id | bitty |+----+-------+| 1 | | | 2 | | +----+-------+2 rows in set (0.00 sec)mysql> select * from test_table where bitty = 1;+----+-------+| id | bitty |+----+-------+| 1 | | | 2 | | +---+-------+2 rows in set (0.00 sec)mysql> select * from test_table where bitty = 0; Empty set (0.00 sec)\[/code\]Those boxes are the \[code\]0x01\[/code\] character, i.e. Doctrine has set the value to 1, not 0.However I can insert 0's into that table direct from MySQL:\[code\]mysql> insert into test_table values (4, b'0');Query OK, 1 row affected (0.00 sec)mysql> select * from test_table where bitty = 0;+----+-------+| id | bitty |+----+-------+| 4 | | +----+-------+1 row in set (0.00 sec)\[/code\]What's going on? Is this a bug in Doctrine?
 
Back
Top