Doctrine 1
  1. Doctrine 1
  2. DC-252

Doctrine ignores UNIQUE:true on int

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.5
    • Fix Version/s: 1.2.0-RC1
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      Gentoo 2.6.21.5, PHP Version 5.2.8

      Description

      Consider this schema.yml:

      Orden:
        tableName: ordenes    
        options:
          type: InnoDB  
        columns:
          id:
            primary: true
            type: integer(4)
            autoincrement: true
          numero: 
            type: integer(4)
            unique: true
      

      sql:

      CREATE TABLE ordenes (id INT AUTO_INCREMENT, numero INT, PRIMARY KEY(id)) COLLATE utf8_unicode_ci ENGINE = InnoDB; 
      

      unique constraint don't appear.

        Activity

        Hide
        Ignacio El Kadre added a comment -

        spliting problem and solution

        Show
        Ignacio El Kadre added a comment - spliting problem and solution
        Hide
        Ignacio El Kadre added a comment -

        Editing Doctrine/DataDict/Mysql.php, getIntegerDeclaration method, adding:

        $unique = (isset($field['unique']) && $field['unique']) ? ' UNIQUE' : ''; //line 490

        and

        return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned
        . $default . $unique . $notnull . $autoinc . $comment; //adding unique field

        the problem was solved.

        Sorry by my english and sorry if this post is in wrong place.
        Cheers
        Ignacio

        Show
        Ignacio El Kadre added a comment - Editing Doctrine/DataDict/Mysql.php, getIntegerDeclaration method, adding: $unique = (isset($field ['unique'] ) && $field ['unique'] ) ? ' UNIQUE' : ''; //line 490 and return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned . $default . $unique . $notnull . $autoinc . $comment; //adding unique field the problem was solved. Sorry by my english and sorry if this post is in wrong place. Cheers Ignacio
        Hide
        Ignacio El Kadre added a comment -

        Don't forget add $unique to return sentence:

        return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned
        . $default . $unique . $notnull . $autoinc . $comment;

        Show
        Ignacio El Kadre added a comment - Don't forget add $unique to return sentence: return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned . $default . $unique . $notnull . $autoinc . $comment;

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Ignacio El Kadre
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: