Incorrect mapping of mysql tinyint(2) as boolean with doctrine
Asked Answered
B

1

7

I reverse engineered my database with symfony2 and doctrine with commands :

php app/console doctrine:mapping:convert
php app/console doctrine:mapping:import
php app/console doctrine:generate:entities

But my field was mapped as boolean instead of tinyint(2).

Why it is mapping as boolean?

Becca answered 4/2, 2013 at 6:3 Comment(3)
I believe doctrine will map based on its unique values, so if that column only contains boolean values (ie. 1 or 0) then that is probably why it is being mapped as a booleanSpoonbill
@Jaitsu is there any reference for it?Becca
Also happened to me with tinyint(3) and tinyint(4), probably also with others but I dont know :)Doubletongued
T
17

tinyint (regardless of length) is mapped to type boolean in the MySQL DBAL platform.

Also, consider that the entity generator is not a reliable tool: it was just meant to give you some help in getting started with larger schemas.

Translative answered 8/2, 2013 at 20:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.