It might be required in Doctrine. A perfectly viable database schema however, is possible without a separate Id for orderItems:
CREATE TABLE `order` ( `id` int(11) NOT NULL, `customer_id` int(11) DEFAULT NULL, `payed` bit(1) DEFAULT NULL, `shipped` bit(1) DEFAULT NULL, `created` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `product` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `current_price` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `order_item` ( `order_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `amount` int(11) DEFAULT NULL, `offered_price` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`order_id`,`product_id`), CONSTRAINT `order_item_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`), CONSTRAINT `order_item_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`) ) On Wednesday, 31 December 2014 10:09:17 UTC+1, Parsifal wrote: > > Order with orderItems is 1:x so why autogenerated id for orderItems is > redundant? In fact this is required. It would be redundant if it was 1:1 > with orderItem as child. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
