Jump to content

Reading a multi dimensional array


compubasic

Recommended Posts

I'm using a PHP framework someone built that allows for easier use of the Autotask ticketing/CRM system API. I have been able to navigate querying the database, but cannot seem to read through the data it returns. A var_dump of the results shows the following:

object(ATWS\AutotaskObjects\QueryResponse)[9]
  public 'queryResult' => 
    object(ATWS\AutotaskObjects\ATWSResponse)[10]
      public 'EntityResults' => 
        object(ATWS\AutotaskObjects\ArrayOfEntity)[11]
          public 'Entity' => 
            array (size=500)
              ...
      public 'EntityResultType' => string 'contact' (length=7)
      public 'EntityReturnInfoResults' => 
        object(ATWS\AutotaskObjects\ArrayOfEntityReturnInfo)[1028]
          public 'EntityReturnInfo' => 
            array (size=500)
              ...
          public 'Fields' => null
          public 'UserDefinedFields' => null
      public 'Errors' => 
        object(ATWS\AutotaskObjects\ArrayOfATWSError)[1027]
          public 'ATWSError' => null
          public 'Fields' => null
          public 'UserDefinedFields' => null
      public 'ReturnCode' => int 1

Can someone please give me guidance on how I can get to the data in this result. I'm trying to get my hands on the "EntityReturnInfo" data. A sample is as follows

 

Here is what a print_r returns


ATWS\AutotaskObjects\QueryResponse Object ( [queryResult] => ATWS\AutotaskObjects\ATWSResponse Object ( [EntityResults] => ATWS\AutotaskObjects\ArrayOfEntity Object ( 

**THIS IS WHERE THE GOOD DATA STARTS***

[Entity] => Array ( [0] => ATWS\AutotaskObjects\Contact Object ( [AccountID] => 174 [Active] => 1 [FirstName] => John [LastName] => Doe [AccountPhysicalLocationID] => [AdditionalAddressInformation] => [AddressLine] => 123 Fake Street [AddressLine1] => Suite 2 [AlternatePhone] => [BulkEmailOptOut] => [BulkEmailOptOutTime] => [City] => Fake City [Country] => United States [CountryID] => 237 [CreateDate] => 2016-09-28T10:17:57.34 [EMailAddress] => Fake@email.com [EMailAddress2] => [EMailAddress3] => [Extension] => [ExternalID] => [FacebookUrl] => [FaxNumber] => [LastActivityDate] => 2016-09-28T11:17:24 [LastModifiedDate] => 2016-09-28T11:17:24.68 [LinkedInUrl] => [MiddleInitial] => [MobilePhone] => [NamePrefix] => [NameSuffix] => [Note] => [Notification] => 1 [Phone] => 123-456-7890 [PrimaryContact] => [RoomNumber] => [SolicitationOptOut] => [SolicitationOptOutTime] => [State] => NY [SurveyOptOut] => [Title] => [TwitterUrl] => [ZipCode] => 12345 [Fields] => [UserDefinedFields] => ATWS\AutotaskObjects\ArrayOfUserDefinedField Object ( [UserDefinedField] => ) [id] => 30682885 ) 

***AND THE DATA CONTINUES WITH***

[1] => ATWS\AutotaskObjects\Contact Object ( [AccountID] => etc etc etc etc

 

Link to comment
Share on other sites

object(ATWS\AutotaskObjects\QueryResponse)[9]
  public 'queryResult' => 
    object(ATWS\AutotaskObjects\ATWSResponse)[10]
      public 'EntityReturnInfoResults' => 
        object(ATWS\AutotaskObjects\ArrayOfEntityReturnInfo)[1028]
          public 'EntityReturnInfo' => 
            array (size=500)
              ...

1. Whatever you dumped was a QueryResponse object.
2. It has a property named "queryResult" which is a ATWSResponse.
3. It has a property named "EntityReturnInfoResults" which is an ArrayOfEntityReturnInfo object.
4. It has a property named "EntityReturnInfo" which is an array of something.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.