Doctrine 1
  1. Doctrine 1
  2. DC-673

Doctrine_Export::dropForeignKey() doesn't format foreign key names

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.2.3
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      PHP 5.3.3-dev, mysql 5.1.41

      Description

      Doctrine_Export::createForeignKey() formats foreign key names, but Doctrine_Export::dropForeignKey() doesn't. It is a problem.

      I tested following:

      echo "<?php

      class addForeignKey extends Doctrine_Migration_Base
      {
      public function up()

      Unknown macro: { $this->createForeignKey('user', 'dotted.foreign.key', array( 'local' => 'category_id', 'foreign' => 'id', 'foreignTable' => 'category', )); }

      }" > migrations/1_add_foreign_key.php

      echo "<?php

      class removeForeignKey extends Doctrine_Migration_Base
      {
      public function up()

      Unknown macro: { $this->dropForeignKey('user', 'dotted.foreign.key'); }

      }" > migrations/2_add_foreign_key.php

      ./doctrine migrate 1 # successful

      ./doctrine migrate 2 # failed

      1 error(s) encountered during migration
      =======================================
      Error #1 - SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'dotted'. Failing Query: "ALTER TABLE user DROP FOREIGN KEY dotted.foreign"

      I have a patch to fix this problem.

        Activity

        Hide
        Kousuke Ebihara added a comment -
        Show
        Kousuke Ebihara added a comment - http://github.com/ebihara/doctrine1/commit/6ae3d28a44796dad13d8387b390515ad45fd26aa I commited a patch to fix this issue to my fork.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Kousuke Ebihara
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: