You are here

protected function ServicesEntityTestHelper::unObject in Services Entity API 7.2

Utility function to recursively turn an object into an array.

@author ChrisO

Parameters

array/object $object: The object, array or element to process

Return value

array An array corresponding to $object, with any objects converted to arrays.

7 calls to ServicesEntityTestHelper::unObject()
ServicesEntityNodeResourceTest::nodeLoad in tests/services_entity.test
Helper function to load a node and process it so it matches the format used by the service controller.
ServicesEntityTestHelper::action in tests/services_entity.test
Helper to perform a RESTful action of a resource.
ServicesEntityTestHelper::create in tests/services_entity.test
Helper to perform a RESTful create of a resource.
ServicesEntityTestHelper::delete in tests/services_entity.test
Helper function to perform a RESTful delete of a resource.
ServicesEntityTestHelper::index in tests/services_entity.test
Helper to performa a RESTful index of a resource.

... See full list

File

tests/services_entity.test, line 177
Services Entity Tests

Class

ServicesEntityTestHelper
Services Entity Test Helper class.

Code

protected function unObject($object) {
  if (is_object($object)) {
    $object = (array) $object;
  }
  if (is_array($object)) {
    foreach ($object as $key => $element) {
      $object[$key] = $this
        ->unObject($element);
    }
  }
  return $object;
}