Doctrine OneToOne identity through foreign entity exception on flush
问题 I have User and UserProfile OneToOne–related Doctrine ORM entities. They should always exist as a pair, there should be no User without UserProfile . User should get its id from autoincrement, while UserProfile should have User's id. So they both should have the same id and there is no other column to set up the relationship (Doctrine docs: Identity through foreign Entities). UserProfile's id is both a primary key (PK) and foreign key (FK) at the same time. I managed to set it up, but it