CristalTeam / php-api-wrapper

:rainbow: Work with APIs like with Laravel Eloquent or Doctrine (no longer a dream)
MIT License
117 stars 32 forks source link

Creating without Saving #18

Closed derekrprice closed 3 years ago

derekrprice commented 3 years ago

I have API Objects that appear to work just fine, but in my tests I am trying to create models without saving. When I do so, I am unable to get the model properties. For instance:

$o = new APIModel([
    'a' => 1,
    'b' => 2
]);
Log::debug($o->a);

Echoes nothing. When I inspect $o->a with the debugger, I get "null". Similarly, relationships that work just fine when loading via the API fail when accessed on a new model object. Am I missing something or is this a bug?

derekrprice commented 3 years ago

Nevermind. When I actually rewrite the code this way, it passes. It must be some artifact of my test harness. Sorry to bother you.