Tharos / LeanMapper

Lean Mapper is a tiny ORM based on powerful Dibi database abstraction library for PHP.
MIT License
87 stars 35 forks source link

Calling initDefaults breaks data retrieving in develop branch #85

Open janedbal opened 9 years ago

janedbal commented 9 years ago
/**
 * @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.

janedbal commented 9 years ago

Commit e4abdef49f2c12e84e3eff3a06a574fd6150f3b5 caused this, any chance this will be reverted? Should I send PR?

janedbal commented 8 years ago

@Tharos Develop branch is now merged in stable, did you miss this issue?

Tharos commented 8 years ago

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!

castamir commented 8 years ago

@Tharos ping

janedbal commented 8 years ago

@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.

castamir commented 8 years ago

@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

Tharos commented 8 years ago

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. :)

castamir commented 8 years ago

ping @Tharos