DDC-2643: Problem on updating an entity with multi-column-identifier with Nullable field #3378

doctrinebot opened this Issue Aug 30, 2013 · 2 comments

2 participants


Jira issue originally created by user hakayashii:

Updating an entity that has an multicolumn-key, where one or more columns can be null, would fail if one column is null. Following senario won't work:

owner int(11) NOT NULL,
partner int(11) NOT NULL,
refNumber int(11) DEFAULT NULL,
text varchar(255) NOT NULL,
UNIQUE KEY refNumber (refNumber),
UNIQUE KEY identifier_key (owner,partner,refNumber)

$em = $this->getDoctrine()->getEntityManager();

$entity = $em->getRepository('CoreBundle:T1') ->findOneBy(array('owner'=>1,'partner'=>2)); // { Entity has following values 'owner':1,'partner':2, 'refNumber':null, 'text': "simple text"}
$entity->setText('another simple text');
// results in following query: UPDATE t1 SET text = ? WHERE owner = ? AND partner = ? AND refNumber = ?
// the query resolves but doesn't change any, because "refNumber = null" should be "refNumber is null" to work


Comment created by @beberlei:

We cannot fix this issue, Doctrine needs the primary key columns to be a value not equaling NULL.


Issue was closed with resolution "Can't Fix"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot closed this 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