DDC-685: Bug in BasicEntityPersister #844

Closed
opened 2026-01-22 12:52:26 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 12, 2010).

Jira issue originally created by user avi:

I have Entity:

class Comments
{
/****
* @Column(type="integer")
* @Id
* @GeneratedValue(strategy="IDENTITY")
*/
private $commentId;

/****
* @Column (type="integer", nullable=true)
*/
private $userId;
...

/****
 * @ManyToOne(targetEntity="Entities\Passport\Clients")
 * @JoinColumn(name="userId", referencedColumnName="clientID")
 */
private $Clients;

...

here i have field userId, and relation with another table on this field.

Where i`m trying to insert (flush) new record in table, i get null value in field userId.

In method _prepareUpdateData (class BasicEntityPersister) field userId overlaps by field of "attachable" table Clents - userId, and sets to null.

Originally created by @doctrinebot on GitHub (Jul 12, 2010). Jira issue originally created by user avi: I have Entity: class Comments { /**** \* @Column(type="integer") \* @Id \* @GeneratedValue(strategy="IDENTITY") */ private $commentId; /**** \* @Column (type="integer", nullable=true) */ private $userId; ... ``` /**** * @ManyToOne(targetEntity="Entities\Passport\Clients") * @JoinColumn(name="userId", referencedColumnName="clientID") */ private $Clients; ... ``` here i have field userId, and relation with another table on this field. Where i`m trying to insert (flush) new record in table, i get null value in field userId. In method _prepareUpdateData (class BasicEntityPersister) field userId overlaps by field of "attachable" table Clents - userId, and sets to null.
admin added the Bug label 2026-01-22 12:52:26 +01:00
admin closed this issue 2026-01-22 12:52:27 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 12, 2010):

Comment created by @beberlei:

First: your mapping is wrong, you are not supposed to map foreign keys. UserId is supposed to be a ManyToOne relation with the User class.

Second: If you want to do this anyways, there is arleady two issues for it: DDC-419 and DDC-522

@doctrinebot commented on GitHub (Jul 12, 2010): Comment created by @beberlei: First: your mapping is wrong, you are not supposed to map foreign keys. UserId is supposed to be a ManyToOne relation with the User class. Second: If you want to do this anyways, there is arleady two issues for it: [DDC-419](http://www.doctrine-project.org/jira/browse/DDC-419) and [DDC-522](http://www.doctrine-project.org/jira/browse/DDC-522)
Author
Owner

@doctrinebot commented on GitHub (Jul 12, 2010):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Jul 12, 2010): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#844