Skip to content

Conversation

alexwhitman
Copy link

Refactors how the type map is built to fix #20. The type names are now defined as keys on the subclass array rather than in the model.

All of the tests pass with some slightly refactored to handle the change.

This is a breaking change.

public function testGetSingleTableTypesOfRoot() {
$types = ['motorvehicle', 'car', 'truck', 'bike'];
$types = ['motorvehicle', 'bike', 'car', 'taxi', 'truck'];

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the surface its kinda terrifying that this expectation changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it's correct as a taxi is a type of Vehicle. The only other change is the ordering but that's only down to how the type map is built.

@jonspalmer
Copy link
Owner

I would expect to see a new test case the prove the problem that this change is expected to fix is truly fixed

@alexwhitman
Copy link
Author

Test case added which ensures the correct model types are instantiated when loading relationships.

@alexwhitman
Copy link
Author

Just to note on this, the failing tests on HHVM appear to be due to a bug in HHVM: facebook/hhvm#7193

The bug causes the code to get into an infinite loop and crash. I can work around it by checking $property->info->class if it's set as HHVM provides extra information which is correct.

@alexwhitman
Copy link
Author

@bostanio Any interest in this or anything you would like clarifying?

@isaackearl
Copy link
Contributor

@alexwhitman I am interested in this... +1

jonspalmer pushed a commit that referenced this pull request Mar 16, 2019
@jonspalmer
Copy link
Owner

jonspalmer commented Mar 16, 2019

I added the test here 6302274 and it passed without these changes.

@jonspalmer jonspalmer closed this Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading from relationship fails due to unknown type
3 participants