I have a difficulty that I can not seem to solve, even if it seems that I found other good I am applying recipes. / P>
I get the following error:
The unit type AppBundle \ Entity \ User \ Student field is missing an unusual ID for the 'user' Identifier Generation Strategy for this unit The id field should be introduced before EntityManager # persist (). Instead you need to adjust the metadata mapping automatically.
There is one relationship between the users of my principles and the symphony 2 between the student 2 and as I am with the student, the student ID, the student ID, I would like to set up on
My two classes are:
class students {/ ** * @ORM \ ID * @ORM \ columns (type = "integer", length = 11) * @ORM / Generated Values (strategy = "auto") * / protected $ id; / ** * @ORM \ Id * @ORM \ OneToOne (target event = "\ AppBundle \ Entity \ user \ user", inverted = "student") * @ORM \ JoinColumn (name = "id", referenced column name = " Id ", nullable = false, strange = true, onDelete =" cascade ") * / personal $ user; ...} class user {/ ** * @ORM \ OneToOne (targetEntity = "\ AppBundle \ Entity \ User \ Student", mapped = "user", cascade = {"stay"}) * / private $ student ; }
When I keep the unit, then I have the error described above, if I continue the organization, then it is okay, if I
$ Entity-> getStudent () -> setUser ($ unit);
Call me, I leave the student to retain the same ID as a user, except that I do not want to be specific in the specific method, because I am the type of service I use a farm manager and it is normal for other tasks.
> Is it possible to set some annotations to set student IDs as user ID when creating student?> Edit:
I've updated your question to you. If possible, then I am not quite despised, but
class students {/ ** * @ORM \ Column (name = "id", type = "integer", nullable = false , Exclusive = true) * @ORM \ Id * / personal $ id; / @ * * @ORM \ OneToOne (target = "\ AppBundle \ Entity \ user \ user", inverted = "student") * @ORM \ JoinColumn (name = "id", referenced column name = "id", nullable = false , Strange = true, on delett = "cascade") * / personal $ user; // <...
I went back to using the id
column, but it was automatically defined before without increment.
Comments
Post a Comment