mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2643: Problem on updating an entity with multi-column-identifier with Nullable field #3317
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Aug 30, 2013).
Originally assigned to: @beberlei on GitHub.
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:
CREATE TABLE
t1(ownerint(11) NOT NULL,partnerint(11) NOT NULL,refNumberint(11) DEFAULT NULL,textvarchar(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');
$em->flush();
// 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
@doctrinebot commented on GitHub (Sep 8, 2013):
Comment created by @beberlei:
We cannot fix this issue, Doctrine needs the primary key columns to be a value not equaling NULL.
@doctrinebot commented on GitHub (Sep 8, 2013):
Issue was closed with resolution "Can't Fix"