Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3113

Associated entity with "cascade" persist that is eagerly loaded doesn't get saved when its parent is flushed

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.4
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Address entity definition within User class
      /**

      • Address
        *
      • @ORM\OneToOne(targetEntity="Address", fetch="EAGER", cascade="persist")
      • @var \Application\Entity\Address
        */
        protected $address;

      When User gets loaded via Doctrine, the resulting Address object within the User is not a proxy object but the concrete class specified in targetEntity. When trying to persist the User:

      $entityManager->persist($user);
      $entityManager->flush($user);

      User object gets saved and another associated entity that is lazy loaded does get saved. What doesn't get saved into the database is the Address object. No exceptions are thrown, the Address object is simply ignored.

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated: