Skip to content

Regression caused by e369cb6 #9849

Open
@asimonf

Description

@asimonf

Bug Report

Q A
BC Break yes
Version 2.12.*

Summary

I have an inheritance tree using joined tables where a version field for optimistic locking exists for a subclass, but not in the parent. Whenever I try to insert, it fails after executing this query:

SELECT versionLock FROM Car WHERE id = '...';

The exception message is 'Unexpected empty result for database query.'

Current behavior

When using Version for optimistic locking in JOINED subclasses, the refresh fails on new inserts since the inserted version does not exist on the parent subclass, yet it tries to refresh the subclass.

The exception is triggered on the BasicEntityPersister.php file here:

        $values = $this->conn->fetchNumeric(
            $sql,
            array_values($flatId),
            $this->extractIdentifierTypes($id, $versionedClass)
        );

        if ($values === false) {
            throw new LengthException('Unexpected empty result for database query.');
        }

How to reproduce

Create an inheritance tree. The parent class must define a JOINED inheritance type and a child class must declare a field with the Version annotation. Afterwards, try to insert a child object into the database. This happens with numeric "version" that have a default value assigned by the database engine.

Expected behavior

That the child is inserted properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions