Calling initDefaults breaks data retrieving in develop branch
/**
* @property null|string $firstname
* @property string $surname
*/
class User extends LeanMapper\Entity {
protected function initDefaults() {
$this->firstname = NULL;
}
}
////////
$user = new User([
'firstname' => 'Vojtěch',
'surname' => 'Kohout',
]);
echo $user->firstname; // returns NULL
echo $user->surname;
Tested on a9d83b5bb260c304dcf68764098e934d71e4f6fd, master branch is ok.
Commit e4abdef49f2c12e84e3eff3a06a574fd6150f3b5 caused this, any chance this will be reverted? Should I send PR?
@Tharos Develop branch is now merged in stable, did you miss this issue?
Ou, I've missed this…
I'll fix it. But I will have to take a look at changes that broke code since I suppose they had some reason…
Thank you for your notice!
@Tharos ping
@castamir So this behaviour has changed in 3.0 and will not be reverted in future releases of 3.x (but there should be big warning about this BC break in release notes) or did you release new stable with this bug intentionally? Anyway, this should be fixed at least in 2.x version.
@janedbal I can revert that commit but without any guarantee, that it won't have any side effect.
I'm not sure if @Tharos will fix this or not, so at least I can revert that change and write a test for your case and then hope that something else won't break as @Tharos mentioned
I keep in mind this issue.
I'm in the middle of leaving my job in Dáme Jídlo (see this post) and I'm really overloaded right now since I have to transfer all my responsibilities…
But after that, this issue is going to be one of the very first things I'll deal with. :)
ping @Tharos