Skip to content

[Bug]: STI child of a JTI entity is merged into the root table and drops the parent's columns #144

Open

Description

@roxblnfk

Describe the bug

An STI child of a JTI entity lands in the wrong table and wipes the JTI parent's columns. With Square → Polygon → Shape, where Shape declares #[JoinedTable] and Polygon declares #[SingleTable], Square is merged into the root shapes table instead of polygons, and removeStiExtraFields() then drops Polygon's columns from it.

Is this a regression?

Not checked.

To Reproduce

  1. Declare Shape with #[JoinedTable], Polygon extends Shape with #[SingleTable] and its own columns, and Square extends Polygon.
  2. Compile the schema with TableInheritance.
  3. Square is mapped to shapes, and Polygon's columns are missing.

Expected behaviour

Square shares the polygons table with Polygon (STI within the JTI child), and Polygon keeps its columns.

Media prove

Not applicable.

Database

All of them (schema compilation, before any SQL).

Your environment

cycle/annotated 4.x, src/TableInheritance.php.

Additional context

Found while killing escaped mutants in #142. The mutants on lines 91, 154, 218 and 220 of TableInheritance.php only differ in this case, so they still survive. Possibly related to the closed #67 (JTI parent has children fields).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions