Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-627

Unexpected Duplicate Field Mapping Exception

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-BETA3
    • Component/s: Mapping Drivers
    • Security Level: All
    • Labels:
      None
    • Environment:

      Description

      Trying to generate entities with annotation mappings using the CLI orm:convert-mapping command will throw an exception.

      – Schema to reproduce
      CREATE DATABASE IF NOT EXISTS `doctrine_issue`;
      USE `doctrine_issue`;
      CREATE TABLE `activity` (
      `idact` int(10) unsigned NOT NULL AUTO_INCREMENT,
      PRIMARY KEY (`idact`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
      CREATE TABLE `activity_log` (
      `idacl` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `idact` int(10) unsigned NOT NULL,
      PRIMARY KEY (`idacl`),
      CONSTRAINT `fk_activity_data_activity` FOREIGN KEY (`idact`) REFERENCES `activity` (`idact`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

      // configure a simple doctrine.php file to connect and run the following CLI command:
      C:\>php doctrine.php orm:convert-mapping --from-database annotation .\Entities

      Will throw an MappingException::duplicateFieldMapping on ActivityLog::idact, at line 1064 of class Doctrine\ORM\Mapping\ClassMetadataInfo

        Issue Links

          Activity

          Alexandre Brina created issue -
          Alexandre Brina made changes -
          Field Original Value New Value
          Affects Version/s 2.0-BETA2 [ 10050 ]
          Description Trying to generate entities with annotation mappings using the CLI orm:convert-mapping command will throw an exception.

          -- Schema to reproduce
          CREATE DATABASE IF NOT EXISTS `doctrine_issue`;
          USE `doctrine_issue`;
          CREATE TABLE `activity` (
            `idact` int(10) unsigned NOT NULL AUTO_INCREMENT,
            PRIMARY KEY (`idact`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
          CREATE TABLE `activity_log` (
            `idacl` int(10) unsigned NOT NULL AUTO_INCREMENT,
            `idact` int(10) unsigned NOT NULL,
            PRIMARY KEY (`idacl`),
            CONSTRAINT `fk_activity_data_activity` FOREIGN KEY (`idact`) REFERENCES `activity` (`idact`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

          // configure a simple doctrine.php file to connect and run the following CLI command:
          C:\>php doctrine.php orm:convert-mapping --from-database annotations .\Entities

          Will throw a MappingException::duplicateFieldMapping on ActivityLog::idact
          Trying to generate entities with annotation mappings using the CLI orm:convert-mapping command will throw an exception.

          -- Schema to reproduce
          CREATE DATABASE IF NOT EXISTS `doctrine_issue`;
          USE `doctrine_issue`;
          CREATE TABLE `activity` (
            `idact` int(10) unsigned NOT NULL AUTO_INCREMENT,
            PRIMARY KEY (`idact`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
          CREATE TABLE `activity_log` (
            `idacl` int(10) unsigned NOT NULL AUTO_INCREMENT,
            `idact` int(10) unsigned NOT NULL,
            PRIMARY KEY (`idacl`),
            CONSTRAINT `fk_activity_data_activity` FOREIGN KEY (`idact`) REFERENCES `activity` (`idact`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

          // configure a simple doctrine.php file to connect and run the following CLI command:
          C:\>php doctrine.php orm:convert-mapping --from-database annotation .\Entities

          Will throw an MappingException::duplicateFieldMapping on ActivityLog::idact, at line 1064 of class Doctrine\ORM\Mapping\ClassMetadataInfo
          Benjamin Eberlei made changes -
          Link This issue is referenced by DDC-616 [ DDC-616 ]
          Benjamin Eberlei made changes -
          Assignee Roman S. Borschel [ romanb ] Benjamin Eberlei [ beberlei ]
          Benjamin Eberlei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.0-BETA3 [ 10060 ]
          Resolution Fixed [ 1 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 11456 ] jira-feedback [ 14452 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback [ 14452 ] jira-feedback2 [ 16316 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 16316 ] jira-feedback3 [ 18569 ]

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Alexandre Brina
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: