Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1226

OneToOne Unidirectional entities not persisting

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      We have the following three entities:

      User
      Participant
      Profile

      ... Users and Participants are two distinctly different things in our system and each has a Profile. Currently we use OneToOne unidirectional associations to "map" the User to it's Profile and a Participant to it's Profile. So far (2.0) we've been able to do the following:

      $profile = $user->getProfile();
      $profile->setLastName('Doe');
      $em->persist($profile);
      $em->flush();

      ...and the profile is saved. In 2.1 rc1 this no longer works.

      After some testing it was determined that 2.1 is requiring that our Profile refer back to each object (bidirectional). Now, this may not be the best example but imagine we had another entity that wanted to make use of a Profile, we'd rather not have to explicitly add the reference back for each entity that wants to use it just to get it persisted.

      Again, in 2.0 our setup worked fine and so far I've been unable to find any documentation pointing to this sort of thing.

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

          Is this relation marked as FETCH=EAGER? Can you post the mapping files of User and Profile please?

          Show
          Benjamin Eberlei added a comment - Is this relation marked as FETCH=EAGER? Can you post the mapping files of User and Profile please?
          Hide
          Benjamin Eberlei added a comment -

          I could reproduce this issue now.

          Show
          Benjamin Eberlei added a comment - I could reproduce this issue now.
          Hide
          Benjamin Eberlei added a comment -

          Fixed

          Show
          Benjamin Eberlei added a comment - Fixed
          Hide
          Erik Hauters added a comment -

          how do you mean? Fixed? Where can I find this fix?

          Show
          Erik Hauters added a comment - how do you mean? Fixed? Where can I find this fix?

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Garrett
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: