Last version 1.3.11 is probably not minor upgrade :)
VitaliiIsaenko opened this issue · 5 comments
I experience a problem after composer updated the minor version of the amazing library you develop.
As far as I understood it's because we don't use typed variables yet. We are still sticking to the annotations.
A very nice change but I'd suggest you consider implementing backwards capability or upgrade a major version of the library.
I can't achieve proper formatting of the stack trace so I will provide it using screenshots, hope it helps
Thanks for taking the time for the screenshots! I didn't expect this to be a BC breaking release, since all test from 7.1 to 7.4 were green. I'm guessing your code contains an edge case for which we don't have a test yet.
I'll investigate the problem and hopefully release a fix soon. In the meantime you'll have to stick to 1.3.10.
Sure, already rolled back. Let me know if any additional info would help you to identify this edge case and I can try to provide it.
Hi @VitaliiIsaenko, the fix was quite easy, but the hard part was trying to reproduce it. Is it possible that you use a custom constructor in your mapping that can sometimes return null
?
I've pushed a fix for this scenario on hotfix/reflection-class-null
. If you can confirm this fixes it for your use case, I'll merge it in master and tag a new release.
Yes, looks like it solves the problem, I don't have the issue with the fix 👍
I don't have any custom constructor in the company model but I use this trick quite often (though don't know if it is related)
$config->registerMapping(DataType::ARRAY, Company::class)
->beConstructedUsing(function (array $a) {
return isset($a['id']) ? null : new Company();
})
I think that's exactly what's causing this :)
Anyway, thanks for letting me know that it works. The new version (1.3.12) is pushed!