You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Second-level STI child gets its own table #143
A second-level STI child gets its own table. With Ceo → Employee → Person, where Person declares #[SingleTable], Ceo is linked to a ceos table instead of people, and SyncTables creates an empty ceos table.
TableInheritance::getTableName() and getDatabase() take the immediate parent ($this->utils->getParent($childClass, false)) and check whether its inheritance is SingleTableInheritanceSchema. For Ceo the immediate parent is Employee, which is itself an STI child and has no inheritance schema of its own, so the method falls back to the child's own table and database instead of walking up to the STI root.
Is this a regression?
Not checked.
To Reproduce
Use the Fixtures16 entities from the test suite: Person (#[SingleTable]), Employee extends Person, Ceo extends Employee.
Compile the schema with TableInheritance and SyncTables.
Ceo's schema points at table ceos, and an empty ceos table is created.
Expected behaviour
Every class in an STI hierarchy uses the root's table and database, whatever its depth.
Found while killing escaped mutants in #142: the mutants on lines 306 and 325 of TableInheritance.php survive because no test covers a second-level STI child.
Activity