Is there a way to prevent the Doctrine from assigning a one-to-one relationship on both sides? Ive tried to move the definition from one side to the other and use its own side, but still puts a restriction on both tables. when I want the parent table to have a constraint - that is. its possible for a parent to not have an associated child.
For example, the following sql schema is essentially:
CREATE TABLE `parent_table` (
`child_id` varchar(50) NOT NULL,
`id` integer UNSIGNED NOT NULL auto_increment,
PRIMARY KEY (`id`)
);
CREATE TABLE `child_table` (
`id` integer UNSIGNED NOT NULL auto_increment,
`child_id` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`child_id`),
CONSTRAINT `parent_table_child_id_FK_child_table_child_id`
FOREIGN KEY (`child_id`)
REFERENCES `parent_table` (`child_id`)
);
However, I get something like this:
CREATE TABLE `parent_table` (
`child_id` varchar(50) NOT NULL,
`id` integer UNSIGNED NOT NULL auto_increment,
PRIMARY KEY (`id`),
CONSTRAINT `child_table_child_id_FK_parent_table_child_id`
FOREIGN KEY (`child_id`)
REFERENCES `child_table` (`child_id`)
);
CREATE TABLE `child_table` (
`id` integer UNSIGNED NOT NULL auto_increment,
`child_id` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`child_id`),
CONSTRAINT `parent_table_child_id_FK_child_table_child_id`
FOREIGN KEY (`child_id`)
REFERENCES `parent_table` (`child_id`)
);
, / ( " " ), , , .
Symfony 1.4.4 (Pear installtion ATM) - sfDoctrinePlugin Doctrine.