嗨,我是symfony的新人。
我尝试使用doctrine从现有数据库生成实体。 当我运行此命令时:
php bin/console doctrine:mapping:import --force AppBundle xml
我得到了这个例外:
[学说\ ORM \映射\ MappingException]
物业" shop" in" Bug"已经宣布,但必须只宣布一次
我试图搜索其他解决方案,但我没有找到任何解决方案。 我该如何解决这个问题?
这就是mysql workbench创建表的方式:
CREATE TABLE IF NOT EXISTS `db`.`bug` (
`id_bug` INT(11) NOT NULL AUTO_INCREMENT,
`bug_name` VARCHAR(200) NOT NULL,
`comment` VARCHAR(1000) NOT NULL,
`status` INT(11) NOT NULL DEFAULT '0',
`customer_id` VARCHAR(255) CHARACTER SET 'utf8' NOT NULL,
`shop_id` VARCHAR(255) CHARACTER SET 'utf8' NOT NULL,
`admin_id` VARCHAR(255) CHARACTER SET 'utf8' NOT NULL,
PRIMARY KEY (`id_bug`),
INDEX `fk_bug_customer1_idx1` (`customer_id` ASC),
INDEX `fk_bug_shop1_idx` (`shop_id` ASC),
INDEX `fk_bug_admin1_idx1` (`admin_id` ASC),
CONSTRAINT `fk_bug_customer1`
FOREIGN KEY (`customer_id`)
REFERENCES `db`.`customer` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_bug_shop1`
FOREIGN KEY (`shop_id`)
REFERENCES `db`.`shop` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_bug_admin1`
FOREIGN KEY (`admin_id`)
REFERENCES `db`.`admin` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
我在symfony 3.3,mysql和php7中工作。
感谢。
答案 0 :(得分:0)
有两个问题: