OrderService getter functions IS Rest API

0

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?

Good Morning @xemacscode.

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();