Hello, I can't create tables for M:N relationship in symfony 1.4. What am I doing wrong?
It should be relation between products and categories in an e-shop. (I first made symfony doctrine:build-schema and only slightly modified it to achieve foreign key creation. Without success :( ) schema.yml TEshopProducts: connection: doctrine tableName: t_eshop_products columns: id: type: integer(8) unsigned: false primary: true autoincrement: true nazev: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false nazev_rozsiren: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false nazev_seo: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false slogan: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false kod: type: string(50) fixed: false unsigned: false primary: false notnull: false autoincrement: false vyrobce: type: integer(4) fixed: false unsigned: true primary: false default: '1' notnull: true autoincrement: false zaruka: type: integer(4) fixed: false unsigned: true primary: false default: '24' notnull: true autoincrement: false cenabezdph_bezna: type: float(10) fixed: false unsigned: false primary: false default: '0.00' notnull: false autoincrement: false cenasdph_bezna: type: float(10) fixed: false unsigned: false primary: false default: '0.00' notnull: false autoincrement: false cenabezdph: type: float(8) fixed: false unsigned: false primary: false default: '0.00' notnull: false autoincrement: false cenasdph: type: float(8) fixed: false unsigned: false primary: false default: '0.00' notnull: false autoincrement: false cenabezdph_akce: type: float(10) fixed: false unsigned: false primary: false notnull: false autoincrement: false cenasdph_akce: type: float(10) fixed: false unsigned: false primary: false notnull: false autoincrement: false cenabezdph_phe: type: float(6) fixed: false unsigned: false primary: false default: '0.00' notnull: true autoincrement: false cenasdph_phe: type: float(6) fixed: false unsigned: false primary: false default: '0.00' notnull: true autoincrement: false stav: type: integer(4) fixed: false unsigned: false primary: false default: '0' notnull: true autoincrement: false sklad: type: integer(4) fixed: false unsigned: false primary: false default: '1' notnull: true autoincrement: false sklad_datum: type: date(25) fixed: false unsigned: false primary: false notnull: false autoincrement: false predtext: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false text: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false kategorie: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false obrazek1: type: string(200) fixed: false unsigned: false primary: false notnull: false autoincrement: false obrazek2: type: string(200) fixed: false unsigned: false primary: false notnull: false autoincrement: false obrazek3: type: string(200) fixed: false unsigned: false primary: false notnull: false autoincrement: false obrazek4: type: string(200) fixed: false unsigned: false primary: false notnull: false autoincrement: false obrazek5: type: string(200) fixed: false unsigned: false primary: false notnull: false autoincrement: false obrazek6: type: string(200) fixed: false unsigned: false primary: false notnull: false autoincrement: false publikovano: type: integer(1) fixed: false unsigned: false primary: false default: '1' notnull: true autoincrement: false poradi: type: integer(4) fixed: false unsigned: false primary: false default: '1' notnull: true autoincrement: false jazyk: type: string(5) fixed: true unsigned: false primary: false default: cs_CZ notnull: true autoincrement: false web_title: type: string(254) fixed: false unsigned: false primary: false notnull: false autoincrement: false web_description: type: string(254) fixed: false unsigned: false primary: false notnull: false autoincrement: false web_keywords: type: string(254) fixed: false unsigned: false primary: false notnull: false autoincrement: false flag_akce: type: integer(1) fixed: false unsigned: false primary: false default: '0' notnull: false autoincrement: false flag_doporucujeme: type: integer(1) fixed: false unsigned: false primary: false default: '0' notnull: false autoincrement: false relations: TEshopProductsCatProductRef: local: id foreign: product_id type: many TEshopProductsCat: connection: doctrine tableName: t_eshop_products_cat columns: id: type: integer(8) fixed: false unsigned: true primary: true autoincrement: true parent: type: integer(8) fixed: false unsigned: true primary: false default: '0' notnull: true autoincrement: false nazev: type: string(200) fixed: false unsigned: false primary: false notnull: true autoincrement: false nazev_menu: type: string(255) fixed: false unsigned: false primary: false notnull: true autoincrement: false nazev_seo: type: string(100) fixed: false unsigned: false primary: false notnull: true autoincrement: false web_title: type: string(70) fixed: false unsigned: false primary: false notnull: true autoincrement: false web_description: type: string(200) fixed: false unsigned: false primary: false notnull: true autoincrement: false web_keywords: type: string(60) fixed: false unsigned: false primary: false notnull: true autoincrement: false popis: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false jazyk: type: string(5) fixed: true unsigned: false primary: false default: cs_CZ notnull: true autoincrement: false poradi: type: integer(4) fixed: false unsigned: true primary: false default: '1' notnull: true autoincrement: false publikovano: type: integer(1) fixed: false unsigned: true primary: false default: '1' notnull: true autoincrement: false relations: TEshopProductsCatProductRef: local: id foreign: category_id type: many TEshopProductsCatProductRef: connection: doctrine tableName: t_eshop_products_cat_product_ref columns: product_id: type: integer(8) fixed: false unsigned: false primary: true autoincrement: false category_id: type: integer(8) fixed: false unsigned: false primary: true autoincrement: false relations: TEshopProducts: local: product_id foreign: id type: one TEshopProductsCat: local: category_id foreign: id type: one But this only generates CREATE TABLE sf_guard_group (id INT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE sf_guard_group_permission (group_id INT, permission_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) ENGINE = INNODB; CREATE TABLE sf_guard_permission (id INT AUTO_INCREMENT, name VARCHAR (255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE sf_guard_remember_key (id INT AUTO_INCREMENT, user_id INT, remember_key VARCHAR(32), ip_address VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id, ip_address)) ENGINE = INNODB; CREATE TABLE sf_guard_user (id INT AUTO_INCREMENT, username VARCHAR (128) NOT NULL UNIQUE, algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, salt VARCHAR(128), password VARCHAR(128), is_active TINYINT(1) DEFAULT '1', is_super_admin TINYINT(1) DEFAULT '0', last_login DATETIME, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx_idx (is_active), PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE sf_guard_user_group (user_id INT, group_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (user_id, group_id)) ENGINE = INNODB; CREATE TABLE sf_guard_user_permission (user_id INT, permission_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (user_id, permission_id)) ENGINE = INNODB; CREATE TABLE t_eshop_products (id BIGINT AUTO_INCREMENT, nazev VARCHAR (255), nazev_rozsiren VARCHAR(255), nazev_seo VARCHAR(255), slogan VARCHAR(255), kod VARCHAR(50), vyrobce INT UNSIGNED DEFAULT '1' NOT NULL, zaruka INT UNSIGNED DEFAULT '24' NOT NULL, cenabezdph_bezna FLOAT (10, 2) DEFAULT 0.00, cenasdph_bezna FLOAT(10, 2) DEFAULT 0.00, cenabezdph FLOAT(8, 2) DEFAULT 0.00, cenasdph FLOAT(8, 2) DEFAULT 0.00, cenabezdph_akce FLOAT(10, 2), cenasdph_akce FLOAT(10, 2), cenabezdph_phe FLOAT(6, 2) DEFAULT 0.00 NOT NULL, cenasdph_phe FLOAT (6, 2) DEFAULT 0.00 NOT NULL, stav INT DEFAULT '0' NOT NULL, sklad INT DEFAULT '1' NOT NULL, sklad_datum DATE, predtext TEXT, text TEXT, kategorie INT, obrazek1 VARCHAR(200), obrazek2 VARCHAR(200), obrazek3 VARCHAR(200), obrazek4 VARCHAR(200), obrazek5 VARCHAR(200), obrazek6 VARCHAR(200), publikovano TINYINT DEFAULT '1' NOT NULL, poradi INT DEFAULT '1' NOT NULL, jazyk CHAR(5) DEFAULT 'cs_CZ' NOT NULL, web_title VARCHAR(254), web_description VARCHAR(254), web_keywords VARCHAR(254), flag_akce TINYINT DEFAULT '0', flag_doporucujeme TINYINT DEFAULT '0', PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE t_eshop_products_cat (id BIGINT UNSIGNED AUTO_INCREMENT, parent BIGINT UNSIGNED DEFAULT '0' NOT NULL, nazev VARCHAR(200) NOT NULL, nazev_menu VARCHAR(255) NOT NULL, nazev_seo VARCHAR(100) NOT NULL, web_title VARCHAR(70) NOT NULL, web_description VARCHAR(200) NOT NULL, web_keywords VARCHAR(60) NOT NULL, popis TEXT, jazyk CHAR(5) DEFAULT 'cs_CZ' NOT NULL, poradi INT UNSIGNED DEFAULT '1' NOT NULL, publikovano TINYINT UNSIGNED DEFAULT '1' NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE t_eshop_products_cat_product_ref (product_id BIGINT, category_id BIGINT, PRIMARY KEY(product_id, category_id)) ENGINE = INNODB; ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE; ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE; ALTER TABLE sf_guard_remember_key ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE; ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE; ALTER TABLE t_eshop_products_cat_product_ref ADD CONSTRAINT tcti FOREIGN KEY (category_id) REFERENCES t_eshop_products_cat(id); ALTER TABLE t_eshop_products_cat_product_ref ADD CONSTRAINT t_eshop_products_cat_product_ref_product_id_t_eshop_products_id FOREIGN KEY (product_id) REFERENCES t_eshop_products(id); Unfortunately mysql report error while creating constraint tcti. Am I missing anything? Mysql 5.1.37 Regards, roy -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.