DDC-351: JoinedSubclassPersister uses id field name in query 'DELETE FROM...' #435

Open
opened 2026-01-22 12:38:07 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 19, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user cloun:

My entity has identity field with name which is not equal with identity column in database:

class File
{
  /****
   * @Column(name="file_id")
   * @Id
   */
  protected $id;
  ...

When this entity is deleted by JoinedSubclassPersister, field name is used instead of column name, so query looks like 'DELETE FROM file WHERE id = ?'.
I think that problem is in Doctrine\ORM\Persisters\JoinedSubclassPersister.php line 275:

    public function delete($entity)
    {
        $id = array_combine(
            $this->_class->identifier,
            $this->_em->getUnitOfWork()->getEntityIdentifier($entity)
        );
       ...

but should like in update method

    public function delete($entity)
    {
        $id = array_combine(
            $this->_class->getIdentifierColumnNames(),
            $this->_em->getUnitOfWork()->getEntityIdentifier($entity)
        );
       ...
Originally created by @doctrinebot on GitHub (Feb 19, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user cloun: My entity has identity field with name which is not equal with identity column in database: ``` class File { /**** * @Column(name="file_id") * @Id */ protected $id; ... ``` When this entity is deleted by JoinedSubclassPersister, field name is used instead of column name, so query looks like 'DELETE FROM file WHERE id = ?'. I think that problem is in Doctrine\ORM\Persisters\JoinedSubclassPersister.php line 275: ``` public function delete($entity) { $id = array_combine( $this->_class->identifier, $this->_em->getUnitOfWork()->getEntityIdentifier($entity) ); ... ``` but should like in update method ``` public function delete($entity) { $id = array_combine( $this->_class->getIdentifierColumnNames(), $this->_em->getUnitOfWork()->getEntityIdentifier($entity) ); ... ```
admin added the Bug label 2026-01-22 12:38:07 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#435