DDC-3113: Associated entity with "cascade" persist that is eagerly loaded doesn't get saved when its parent is flushed #3890

Open
doctrinebot opened this Issue May 1, 2014 · 0 comments

2 participants

@doctrinebot

Jira issue originally created by user jurajs:

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.

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment