Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3089

Doctrine1 to Doctrine2 Oracle type float

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Linux - Oracle 10g

      Description

      I have a big problem migrating an application from Doctrine1 to Doctrine2.

      The variable ROUNDNUMBER was set with Doctrine1 in the Oracle 10G database with the following schema :
      ApprenticeYeartype:
      columns:
      id:

      {type: integer, notnull: true, primary: true, autoincrement: true}

      name:

      {type: string(255), notnull: true}

      roundNumber:

      {type: float, notnull: true}

      The values stored in this variable are: 0.1 or 0.5 or 1.0

      In Oracle, the data type was set as "NUMBER" with no precision or scale set. I found this "If
      a precision is not specified, the column stores values as given. If no scale is
      specified, the scale is zero. ".
      So there should be no scale which is weird because it worked with the values 0.1, 0.5...
      It worked nicely on Symfony1 and Doctrine1, but for the migration to Symfony2 and Doctrine2, I used the command to import the schema from the database "php app/console doctrine:mapping:convert"

      The created schema's ROUNDNUMBER variable was set with the Doctrine2 type "Integer". So now I get the variable as an int and not float and so I can't use it.

      I tried changing the type to decimal, float etc...
      /**

      • @var integer
        *
      • @ORM\Column(name="ROUNDNUMBER", type="integer", nullable=false)
        */
        private $roundnumber;

      But I keep getting this error :
      [Doctrine\DBAL\DBALException]
      An exception occurred while executing 'ALTER TABLE APPRENTICE_YEARTYPE MODI
      FY (ROUNDNUMBER DOUBLE PRECISION DEFAULT NULL)':

      ORA-01440: column to be modified must be empty to decrease precision or sca
      le

      If anyone know a solution, please help me !

        Activity

        Hide
        Steve Müller added a comment -

        Looks like you create the column ROUNDNUMBER with an integer type mapping. Use "float" or "decimal" instead. When updating the schema please ensure that your ROUNDNUMBER column contains no data or at least all values in the column have to be NULL. See http://www.techonthenet.com/oracle/errors/ora01440.php
        Please note that Doctrine's "float" maps to "DOUBLE PRECISION" and "decimal" to "NUMERIC(p,s)" on Oracle. See the DBAL types documentation for further information: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix

        If you need further help, just drop me a line.

        Show
        Steve Müller added a comment - Looks like you create the column ROUNDNUMBER with an integer type mapping. Use "float" or "decimal" instead. When updating the schema please ensure that your ROUNDNUMBER column contains no data or at least all values in the column have to be NULL. See http://www.techonthenet.com/oracle/errors/ora01440.php Please note that Doctrine's "float" maps to "DOUBLE PRECISION" and "decimal" to "NUMERIC(p,s)" on Oracle. See the DBAL types documentation for further information: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix If you need further help, just drop me a line.
        Hide
        Steve Müller added a comment -

        Not a Doctrine bug.

        Show
        Steve Müller added a comment - Not a Doctrine bug.

          People

          • Assignee:
            Steve Müller
            Reporter:
            Antoine Dr
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: