While using one-to-one relationships in theory, I thought that the theory would usually create a unique obstacle on the column ? (This will prevent the same foreign id from recording more than one record, and therefore, sometimes, to stop the connection sometimes and sometimes)
I am pretty sure that I have seen this behavior in the past. Currently relations are treating many-to-one, like it's an observation of me
Here are my entities which do not have the same (I'm using tables Inheritns have to include those institutions To be done)
& lt ;? php / ** * @ORM \ unit () * / class IplanLayerImage extends ChildIplanLayerImage {/ ** * @ORM \ OneToOne (targetEntity = "IplanLayer", inversedBy = "iplanLayerImage") * @ORM \ JoinColumn (name = "image_iplan_layer_id" , Referenced columnname = "id", faucet = true) ** / protected $ imageIplanLayer; / * .................. * /} / ** * @ORM \ Table (name = "iplan_layer") * @ORM \ unit () * / class IplanLayer { / ** * @ORM \ OneToOne (target = "iPlayLayer image", mapped = "Image Implaner Layer") ** / Protected $ iplanLayerImage; / * .................. * /} / ** * @ORM \ unit * / class child transit image uploads {/ * ......... . ........ * /} / ** * @ORM \ unit * @ORM \ table ( "upload") * @ORM \ InheritanceType ( "SINGLE_TABLE") * @ORM \ DiscriminatorColumn (name = "Discr ", type =" string ") * @ORM \ unit () * @ORM \ DiscriminatorMap ({*" photo "=" photo ", *" child_photo "=" ChildPhoto ", *" iplan_layer_image "=" IplanLayerImage ", * Upload "child_iplan_layer_image" = "ChildIplanLayerImage" *}) * / abstract class Upload {/ * ........ * /}
"that I would expect "Table (IplanLayerImage unit), column image_iplan_layer_id will be a unique obstacle. However, the SQL generated by "Application / Console Principle: Schema: Update" (updated was ran against an empty database) and more will look like this
Table Upload (ID INT AUTO_INCREMENT NO NULL , image_iplan_layer_id INT default zero ........... index IDX_l7BDE6lF8FD952Fl (Image_iplan_layer_id), pRIMARY KEY (id)) table Iplan_layer (id INT AUTO_INCREMENT nOT nULL, ........... cause Index IDX_14E915C1BE04EA9 (Jobs_ID), Primary Key (ID)) Upload optional tab uploads Switch to Added FK_17BDE61F8FD952F1 foreign key (image_iplan_layer_id) reference iplan_layer (id);
Why is no specific signal created?
Symfony 2.6.3
Principle 2.5
No comments:
Post a Comment