Skip to content

Incorrect subclasses dependencies weight while calculating commit orders #10715

@sylfabre

Description

@sylfabre

Bug Report

Q A
BC Break no
Version 2.15.1

Summary

The weight of subclasses' dependencies is always 1 while the parent class' dependencies weight comes from the nullable attribute of the join columns.

Current behavior

Parent class and subclasses' dependencies don't have the same weight.

How to reproduce

Imagine this setup with 3 entities

  • City

  • Street (can be Street, Boulevard, or Avenue as inheritance mapping)

  • House

  • House has a Street (not null)

  • Street has a City (not null)

  • City has a main Street (nullable as we have to first insert the City before the Street due to foreign key constraints)

  • Street has a main House (nullable as we have to first insert the Street before the House due to foreign key constraints)

Expected dependencies are:

  • from House to Street, Boulevard, and Avenue with weight=0
  • from Street, Boulevard, and Avenue to City with weight=0
  • from City to Street, Boulevard, and Avenue with weight=1
  • from Street, Boulevard, and Avenue to House with weight=1

Current dependencies are:

  • from House to Street, Boulevard, and Avenue with weight=0
  • from Street to City with weight=0
  • from Boulevard and Avenue to City with weight=1 KO
  • from City to Street, Boulevard, and Avenue with weight=1
  • from Street, Boulevard, and Avenue to House with weight=1

This comes from UnitOfWork::getCommitOrder() which always uses 1 as weight when calling $calc->addDependency() for subclasses (see #10716 about a suggested fix)

Expected behavior

Parent class and subclasses' dependencies have the same weight.

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