I am using only the DBAL part of Doctrine for my project. So I have to care over the mapping myself. I figured out that Doctrine remaps database types to a generic PHP type as you can read here [1].
Now I came across the fact that Doctrine maps the DB type TinyInt(4) to Boolean. According to the MySQL manual only TinyInt(1) is equivalent to Boolean [2]. Since my project is a legacy one which I like to move from mysqli to Doctrine, I need to stick on the native DB Types.
My question is now how I get the native db type out of Doctrine?
Thanks in advance for your help.
Stefano
[1] http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html [2] http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html
I opend up a report in Doctrine issue tracker to figure out why Doctrine works like that. The answer is simple:
The length of TinyInt doesn't say anything about the size of the value which could be stored. Its in any case 1 Byte, but it effects the filling zeros in case you use this option for your field.
Doctrine maps his own boolean type to the mysql tinyint type because MySQL don't provide an own boolean type.
For more informations you can read more on the ticket:
http://www.doctrine-project.org/jira/browse/DBAL-781