flightphp / active-record

Micro Active Record library in PHP, supports chain calls, events, and relations.
https://docs.flightphp.com/awesome-plugins/active-record
MIT License
7 stars 3 forks source link

Bug: isHydrated() remains true even after reset() #10

Closed starfishpatkhoo closed 2 months ago

starfishpatkhoo commented 2 months ago

I think isHydrated() should be cleared when we reset()

$user->find();
echo $user->isHydrated() ? "Yes" : "No";  // Yes
echo $user->name;  // "John Doe"
$user->reset();
echo $user->isHydrated() ? "Yes" : "No";  // Yes
var_dump($user->name);  // NULL
var_dump($user->toArray());  // array(0){}
n0nag0n commented 2 months ago

That prob needs to be tweaked as well! If you want an easy PR opportunity, this is your moment ;) haha

starfishpatkhoo commented 2 months ago

That prob needs to be tweaked as well! If you want an easy PR opportunity, this is your moment ;) haha

Ha ha ha ! Let me hit my deadline first.. Then I can come back and look at this.. ^_^

n0nag0n commented 2 months ago

https://github.com/flightphp/active-record/commit/e90cf11cf2d844701827788bd417a8f3545b3155 No worries, I gotcha covered. I'll release this soon, but you can use the dev-master if you need to

starfishpatkhoo commented 2 months ago

Thanks man.. will check it out.. I need to hit my project deadline first..

n0nag0n commented 2 months ago

Good luck meeting your deadlines!