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

accessor methods for order class/object #246

Open
xemacscode opened this issue Mar 19, 2020 · 1 comment
Open

accessor methods for order class/object #246

xemacscode opened this issue Mar 19, 2020 · 1 comment

Comments

@xemacscode
Copy link

I'm trying to iterate through the orders using API Rest by using this code:

$results = $infusionsoft->orders()->where('limit',$limit)->where('offset', $offset)->get();

But I'm getting this result:

object(Infusionsoft\Api\Rest\OrderService)[8]
          public 'full_url' => string 'https://api.infusionsoft.com/crm/rest/v1/orders' (length=47)
          public 'return_key' => string 'orders' (length=6)
          protected 'client' => 
            object(Infusionsoft\Infusionsoft)[4]
              ...
          protected 'where' => 
            array (size=2)
              ...
          protected 'updateVerb' => string 'put' (length=3)
          protected 'primaryKey' => string 'id' (length=2)
          protected 'optionalProperities' => 
            array (size=0)
              ...
          protected 'attributes' => 
            array (size=20)
              ...
          protected 'hidden' => 
            array (size=0)
              ...
          protected 'visible' => 
            array (size=0)
              ...
          protected 'appends' => 
            array (size=0)
              ...
          protected 'casts' => 
            array (size=0)

What I want to do is to get the protected attributes but I can't find any documentation on how to get its values. I want to get all attributes by using getter methods if there's available method for that. Anyone can guide me on this?

@ajohnson6494
Copy link
Contributor

I believe all you have to do is call ->toArray() and that should return an array of all the attributes. There is also a ->toJSON() method as well.

So, your whole command might look like:

$results = $infusionsoft->orders()->where('limit',$limit)->where('offset', $offset)->get()->toArray();

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

No branches or pull requests

2 participants