spinen / laravel-clickup

SPINEN's Laravel Package for ClickUp.
27 stars 14 forks source link

Trying to access spaces causes an error (preventsAccessingMissingAttributes) #33

Open yavle opened 11 months ago

yavle commented 11 months ago

Executing the following code in Laravel 10 app produces an error: Undefined property: Spinen\ClickUp\Team::$wasRecentlyCreated

    $user = new User([
        'name' => 'user',
        'email' => 'test2@test.xz',
        'password' => '123',
        'clickup_token' => '%%%%%%',
    ]);
    $user->save();
    $spaces = $user->clickUp()->teams->first()->spaces;

I believe the reason to be is updates in Laravel 9.x - see files Model.php and HasAttributes.php

riaanjfox commented 5 months ago

Any movement or workarounds on this? This is breaking on L9 and were now up to L11.

jimmypuckett commented 5 months ago

Addressed in 1.4.0

riaanjfox commented 4 months ago

This is still happening on Laravel 9 and dev version 1.4.0.

jimmypuckett commented 4 months ago

OK, I am now able to recreate this, but I am seeing a 'WARNING-- not anERROR` & I get the spaces...

$user->clickUp()
  ->teams->first()
  ->spaces->toArray();
   WARNING  Undefined property: Spinen\ClickUp\Team::$wasRecentlyCreated in vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 497.

[
    [
      "id" =><removed>,
      "name" => "<removed>",
      "color" => null,
      "private" => true,
      "avatar" => null,
      "admin_can_manage" => null,
      // ...
]

I don't have a L9 app & I don't have time to set one up, but I will get this addressed for L11 tonight & hopefully, it will make it work on L9.

Are you seeing a warning or error?

riaanjfox commented 4 months ago

It's throwing an exception:


ErrorException: PHP 8.1.6 - Undefined property: Spinen\ClickUp\Team::$wasRecentlyCreated

foreach ($team->spaces as $space) {
// here
}
riaanjfox commented 4 months ago

Any movement on this?