Php 如何为该表生成一对多实体使用规则生成器
一个客户有一个默认发货地址,一个地址连接到一个客户 致命错误:已声明未捕获异常“条令\ORM\Mapping\MappingException”,消息“App\Model\Address”中的“Property”customer,但该异常为 st只能在第381行的D:\wamp64\www\app\vendor\doctrine\orm\lib\doctrine\orm\Mapping\MappingException.php中声明一次Php 如何为该表生成一对多实体使用规则生成器,php,sql,doctrine,Php,Sql,Doctrine,一个客户有一个默认发货地址,一个地址连接到一个客户 致命错误:已声明未捕获异常“条令\ORM\Mapping\MappingException”,消息“App\Model\Address”中的“Property”customer,但该异常为 st只能在第381行的D:\wamp64\www\app\vendor\doctrine\orm\lib\doctrine\orm\Mapping\MappingException.php中声明一次 DROP TABLE IF EXISTS `address
DROP TABLE IF EXISTS `address`;
CREATE TABLE `address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` int(11) DEFAULT NULL,
`region_code` varchar(255) DEFAULT NULL,
`district` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL ON UPDATE NOW(),
PRIMARY KEY (`id`),
KEY `IDX_B97FF0589395C3F3` (`customer_id`),
CONSTRAINT `FK_B97FF0589395C3F3` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shipping_address_id` int(11) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`mobile` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`birthday` datetime DEFAULT NULL,
`gender` varchar(1) NOT NULL DEFAULT 'u',
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL ON UPDATE NOW(),
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_7E82D5E64D4CFF2B` (`address_id`),
CONSTRAINT `FK_7E82D5E64D4CFF2B` FOREIGN KEY (`shipping_address_id`) REFERENCES `address` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8;
条令\ORM\Mapping\MappingException:“App\Model\Address”中的属性“customer”已声明,但只能在D:\wamp64\www\App\v中声明一次
第381行的endor\doctor\orm\lib\doctor\orm\Mapping\MappingException.php
DROP TABLE IF EXISTS `address`;
CREATE TABLE `address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` int(11) DEFAULT NULL,
`region_code` varchar(255) DEFAULT NULL,
`district` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL ON UPDATE NOW(),
PRIMARY KEY (`id`),
KEY `IDX_B97FF0589395C3F3` (`customer_id`),
CONSTRAINT `FK_B97FF0589395C3F3` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shipping_address_id` int(11) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`mobile` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`birthday` datetime DEFAULT NULL,
`gender` varchar(1) NOT NULL DEFAULT 'u',
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL ON UPDATE NOW(),
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_7E82D5E64D4CFF2B` (`address_id`),
CONSTRAINT `FK_7E82D5E64D4CFF2B` FOREIGN KEY (`shipping_address_id`) REFERENCES `address` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8;
你知道这件事吗?或者你能告诉我如何设计它使它更清晰吗
提前谢谢。我已经使用了此链接中的更改,但它不起作用。我已经在这个链接中使用了更改,但它不起作用。