Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-781

Doctrine maps tinyint with length > 1 to boolan

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Environment:
      OSX 10.8, PHP 5.4, MySQL 5.6

      Description

      Why Doctrine maps any tinyint, regardless its length to boolean type. According to the MySQL Documentation only tinyint(1) is equivalent to boolean. I searched the web and found only out that this is the way how Doctrine it does but not why, so I have to assume its a bug.

      Hope someone who knows Doctrine better could enlighten me

        Activity

        Hide
        Steve Müller added a comment - - edited

        Stefano Kowalke The length parameter for MySQL's integer does not have any effect unless you use it in conjunction with the ZEROFILL attribute. It does not have any meaning concerning min or max value and the storage requirements for that specific type but only specifies the display length for zerofill characters.

        M indicates the maximum display width for integer types. For floating-point and fixed-point types, M is the total number of digits that can be stored. For string types, M is the maximum length. The maximum allowable value of M depends on the data type.

        As MySQL does not have a native boolean type, Doctrine uses it to map it's own boolean type as it is the one that comes closest to a "boolean" type column. This is not a bug in Doctrine but an expected behaviour.
        Hope I could clarify this.

        Show
        Steve Müller added a comment - - edited Stefano Kowalke The length parameter for MySQL's integer does not have any effect unless you use it in conjunction with the ZEROFILL attribute. It does not have any meaning concerning min or max value and the storage requirements for that specific type but only specifies the display length for zerofill characters. M indicates the maximum display width for integer types. For floating-point and fixed-point types, M is the total number of digits that can be stored. For string types, M is the maximum length. The maximum allowable value of M depends on the data type. As MySQL does not have a native boolean type, Doctrine uses it to map it's own boolean type as it is the one that comes closest to a "boolean" type column. This is not a bug in Doctrine but an expected behaviour. Hope I could clarify this.
        Hide
        Stefano Kowalke added a comment -

        Hey Steve, thanks for your detailed informations. This helped me to understand the behavior and gave me a direction how to get more background informations.

        Show
        Stefano Kowalke added a comment - Hey Steve, thanks for your detailed informations. This helped me to understand the behavior and gave me a direction how to get more background informations.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Stefano Kowalke
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: