Skip to content

Loading…

DDC-1386: getPartialReference() will result in data loss if default values are used #2006

Closed
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user stefanklug:

If a entity uses default values e.g.

class User {
    private $id;
    private $name = "unnamed";
}

a reference returned from EntityManager::getPartialReference() will automatically result in a scheduled update for this entity (and all fields with default values), because the EM expects the fields of the entity to be empty. This results in resetting all data inside the database to the default values when doing an $em->flush().

Regards Stefan

@doctrinebot

Comment created by @beberlei:

Verified, have a fix for this already but its rather tricky with how far i want to push this.

@doctrinebot

Comment created by @beberlei:

I committed a fix into master and 2.1.x 3801e0c

This could somewhat be considered a BC. But i doubt people use partial objects to update the fields they omitted.

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.1.3 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.