Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1967

mysql Tiny ints not behaving properley

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 2.2.2
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      mysql 5.1.58, php 5.3

      Description

      If I set up a field as a tinyint lets say called bob. I then extract a record.

      If I do $object->getBob() - when bob = 1, everything works fine.

      However, if I do $object->getBob() when bob = 0, the null value is returned.

      If bob is null, everything works fine.

      This issues only seems to happen with mysql tinyint.

        Activity

        jonathanpete Jonathan Robinson created issue -
        asm89 Alexander made changes -
        Field Original Value New Value
        Status Open [ 1 ] Awaiting Feedback [ 10000 ]
        Hide
        asm89 Alexander added a comment -

        I guess it is 'false' that is being returned? That's because MySql's tinyint will be mapped as boolean (by doctrine dbal).

        Show
        asm89 Alexander added a comment - I guess it is 'false' that is being returned? That's because MySql's tinyint will be mapped as boolean (by doctrine dbal).
        Anonymous made changes -
        Status Awaiting Feedback [ 10000 ] In Progress [ 3 ]
        Hide
        jonathanpete Jonathan Robinson added a comment -

        No. The value "" is returned as in an empty string.

        Show
        jonathanpete Jonathan Robinson added a comment - No. The value "" is returned as in an empty string.
        Hide
        beberlei Benjamin Eberlei added a comment -

        can you show your mapping for this value?

        Show
        beberlei Benjamin Eberlei added a comment - can you show your mapping for this value?
        Hide
        jonathanpete Jonathan Robinson added a comment -

        Sure. Mapping is:

        /**

        • @var boolean $isvegetarian
          *
        • @Column(name="IsVegetarian", type="boolean", nullable=true)
          */
          private $isvegetarian;

        DBAL maps field as a tiny int. If I manually set field to 0, DBAL returns null. If I set to null, DBAL returns null. If I set to 1, DBAL returns true.

        Show
        jonathanpete Jonathan Robinson added a comment - Sure. Mapping is: /** @var boolean $isvegetarian * @Column(name="IsVegetarian", type="boolean", nullable=true) */ private $isvegetarian; DBAL maps field as a tiny int. If I manually set field to 0, DBAL returns null. If I set to null, DBAL returns null. If I set to 1, DBAL returns true.
        Hide
        jonathanpete Jonathan Robinson added a comment -

        I installed the new version, then reverted back and the problem seems to have gone away. I'm very confused!! Perhaps it was an installation problem at my end. But can't think what. Oh well...

        Show
        jonathanpete Jonathan Robinson added a comment - I installed the new version, then reverted back and the problem seems to have gone away. I'm very confused!! Perhaps it was an installation problem at my end. But can't think what. Oh well...
        jonathanpete Jonathan Robinson made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        jonathanpete Jonathan Robinson added a comment -

        nope, i'm wrong. it is a bug - something else fooled me into thinking it was working. I have tried setting up other boolean data fields and the same issue occurs.

        Show
        jonathanpete Jonathan Robinson added a comment - nope, i'm wrong. it is a bug - something else fooled me into thinking it was working. I have tried setting up other boolean data fields and the same issue occurs.
        jonathanpete Jonathan Robinson made changes -
        Resolution Cannot Reproduce [ 5 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        jonathanpete Jonathan Robinson made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-1967}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            jonathanpete Jonathan Robinson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: