single-table-inheritance icon indicating copy to clipboard operation
single-table-inheritance copied to clipboard

`newFromBuilder` does not maintain mutated attributes

Open sarahmarshy opened this issue 3 years ago • 2 comments

https://github.com/jonspalmer/single-table-inheritance/blob/main/src/SingleTableInheritanceTrait.php#L188

Constructing this object with no attributes and then setting them as "filtered" does not mutate properties that are intended to be mutated.

I have verified that passing the attributes directly to the constructor does mutate the intended properties.

sarahmarshy avatar Sep 02 '21 18:09 sarahmarshy

I'm not completely following the problem. Can you provide a failing test case in a PR?

jonspalmer avatar Sep 03 '21 02:09 jonspalmer

@jonspalmer, went ahead and did that. You can see the failure in this test case -- https://github.com/jonspalmer/single-table-inheritance/pull/71/files#diff-4b4e276a9a1eda9f7dbedda3cd6730765e4f0efba71a699d4e80a49d03054240R36

I made one that passes using direct instantiation as well.

sarahmarshy avatar Sep 03 '21 21:09 sarahmarshy