Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-838

SchemaTool - ignores the attribute uniq in relations

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0-BETA4
    • Fix Version/s: 2.x
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      Ubuntu, PHP 5.3.2, MySQL

      Description

      Mapper
      <entity name="Default_Model_Test" table="test">
        <id name="id" type="integer" column="id">
          <generator strategy="AUTO"/>
        </id>
        <field name="blabla" column="blabla" type="boolean"/>
        <one-to-one field="user" target-entity="Users_Model_User">
          <join-column name="users_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE" unique="false" />
        </one-to-one>
      </entity>
      
      SQL
      CREATE TABLE test (id INT AUTO_INCREMENT NOT NULL, users_id INT DEFAULT NULL, blabla TINYINT(1) NOT NULL, UNIQUE INDEX test_users_id_uniq (users_id), PRIMARY KEY(id)) ENGINE = InnoDB;
      ALTER TABLE test ADD FOREIGN KEY (users_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
      

      Actual:
      UNIQUE INDEX test_users_id_uniq (users_id)

      Expected:
      INDEX test_users_id (users_id)

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Verified, i just don't understand why you are using a one-to-one relation and then "deactivate" the database constraint for this. You could easily use Many-To-One

        Show
        Benjamin Eberlei added a comment - Verified, i just don't understand why you are using a one-to-one relation and then "deactivate" the database constraint for this. You could easily use Many-To-One
        Hide
        gektor added a comment - - edited

        You are right. It's not a bug, it's feature.

        Show
        gektor added a comment - - edited You are right. It's not a bug, it's feature.
        Hide
        Benjamin Eberlei added a comment -

        This might still be a good improvement to allow the flexibility, but its not a bug. Updating to "Minor Improvmenet for 2.x"

        Show
        Benjamin Eberlei added a comment - This might still be a good improvement to allow the flexibility, but its not a bug. Updating to "Minor Improvmenet for 2.x"

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            gektor
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: