嗨,我是 symfony 的新手。
我正在尝试从具有教义的现有数据库中生成实体。当我运行这个命令时:
php bin/console doctrine:mapping:import --force AppBundle xml
我得到这个例外:
[Doctrine\ORM\Mapping\MappingException]
"Bug" 中的属性 "shop" 已声明,但只能声明一次
我试图搜索其他解决方案,但我没有找到任何东西。我怎么解决这个问题?
这是 mysql 工作台创建我的表的方式:
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。
谢谢。