Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yavle opened this issue Oct 4, 2023 · 7 comments · May be fixed by #36
Open

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

yavle opened this issue Oct 4, 2023 · 7 comments · May be fixed by #36

Comments

@yavle
Copy link

yavle commented Oct 4, 2023

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

    $user = new User([
        'name' => 'user',
        'email' => '[email protected]',
        '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
Copy link

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

@jimmypuckett jimmypuckett mentioned this issue Apr 8, 2024
@jimmypuckett
Copy link
Member

Addressed in 1.4.0

@riaanjfox
Copy link

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

@jimmypuckett
Copy link
Member

jimmypuckett commented Apr 16, 2024

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?

@jimmypuckett jimmypuckett reopened this Apr 16, 2024
@riaanjfox
Copy link

riaanjfox commented Apr 16, 2024

It's throwing an exception:


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

foreach ($team->spaces as $space) {
// here
}

@riaanjfox
Copy link

Any movement on this?

travisaustin added a commit to travisaustin/laravel-clickup that referenced this issue Nov 4, 2024
@travisaustin travisaustin linked a pull request Nov 4, 2024 that will close this issue
@travisaustin
Copy link

travisaustin commented Nov 4, 2024

I've submitted a PR that adds a property to the Model class. This new property fixes the issue reported in this issue.

If you'd like to use this change before it's accepted and released as a new version, you can modify your project's composer.json file to include the ClickUp package like this:

    "require": {
        "spinen/laravel-clickup": "dev-master#63acad405db1e53d05784bd820d8d9b7ee8cef8f"
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants