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

for each on client->projects->getProjects() return error #93

Open
JeremieBergeron opened this issue Jun 29, 2022 · 3 comments
Open

for each on client->projects->getProjects() return error #93

JeremieBergeron opened this issue Jun 29, 2022 · 3 comments

Comments

@JeremieBergeron
Copy link

What I want: Get all my project.

What I have try:
I get an error (I have multiple project):

$asana_client = Client::accessToken(env('ASANA_PERSONAL_ACCESS_TOKEN'));

$projects = $asana_client->projects->getProjects();

foreach ($projects as $project) {
	dump($project);
}

Environment: I am using laravel 9 which use php 8.0.13

PS:
This works:

$asana_client = Client::accessToken(env('ASANA_PERSONAL_ACCESS_TOKEN'));

$projects = $projects = $asana_client->get('/projects', []);

foreach ($projects as $project) {
	dump($project);
}
@t-walker-wei
Copy link

t-walker-wei commented Aug 18, 2022

@JeremieBergeron What error did you get?
I also cannot get the query result correctly.

Code:

$client = Asana\Client::accessToken(env('ASANA_PERSONAL_ACCESS_TOKEN'));
$projects = $client -> stories -> findByTask(
                                '{task id existing in my account}', 
                                array(), 
                                array('opt_pretty' => 'true')
    );
print_r( $projects );

Get:

Asana\Iterator\CollectionPageIterator Object
(
    [sync] => 
    [client] => Asana\Client Object
        (
            [dispatcher] => Asana\Dispatcher\AccessTokenDispatcher Object
                (
                    [accessToken] => ************************
                )

            [options] => Array
                (
                    [base_url] => https://app.asana.com/api/1.0
                    [item_limit] => 
                    [page_size] => 50
                    [poll_interval] => 5
                    [max_retries] => 5
                    [full_payload] => 
                    [iterator_type] => items
                    [log_asana_change_warnings] => 1
                )

            [attachments] => Asana\Resources\Attachments Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [custom_fields] => Asana\Resources\CustomFields Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [custom_field_settings] => Asana\Resources\CustomFieldSettings Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [events] => Asana\Resources\Events Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [jobs] => Asana\Resources\Jobs Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [organization_exports] => Asana\Resources\OrganizationExports Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [portfolios] => Asana\Resources\Portfolios Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [portfolio_memberships] => Asana\Resources\PortfolioMemberships Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [projects] => Asana\Resources\Projects Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [project_memberships] => Asana\Resources\ProjectMemberships Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [project_statuses] => Asana\Resources\ProjectStatuses Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [stories] => Asana\Resources\Stories Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [sections] => Asana\Resources\Sections Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [tags] => Asana\Resources\Tags Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [tasks] => Asana\Resources\Tasks Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [teams] => Asana\Resources\Teams Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [users] => Asana\Resources\Users Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [user_task_lists] => Asana\Resources\UserTaskLists Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [workspaces] => Asana\Resources\Workspaces Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

            [webhooks] => Asana\Resources\Webhooks Object
                (
                    [client] => Asana\Client Object
 *RECURSION*
                )

        )

    [path] => /tasks/1202775372758012/stories
    [query] => Array
        (
        )

    [options] => Array
        (
            [base_url] => https://app.asana.com/api/1.0
            [item_limit] => 
            [page_size] => 50
            [poll_interval] => 5
            [max_retries] => 5
            [full_payload] => 1
            [iterator_type] => items
            [log_asana_change_warnings] => 1
            [opt_pretty] => true
        )

    [itemLimit] => INF
    [pageSize] => 50
    [count] => 0
    [continuation] => 
    [currentPage] => 
    [currentPageNumber] => 0
)

@JeremieBergeron
Copy link
Author

I think i had the same error has you.

This repos seems a little bit dead ^^'

@asabosch
Copy link

I also have problems regarding "getProjects" – but there is a workaround:

Asana\Client::accessToken(PAT, array('headers' => array('asana-disable' => 'new_goal_memberships'));

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

No branches or pull requests

3 participants