Ejemplo n.º 1
0
 /**
  * Render a representation of a ResourceEmbedded object.
  *
  * @param   ResourceEmbedded  $resource  An embedded resources object.
  *
  * @return  A representation of the object.
  */
 public function renderResourceEmbedded(ResourceEmbedded $resource)
 {
     $xml = '';
     foreach ($resource->getResources() as $embeddedList) {
         foreach ($embeddedList as $embedded) {
             $xml .= $this->render($embedded);
         }
     }
     return $xml;
 }
Ejemplo n.º 2
0
 /**
  * Render a representation of a ResourceEmbedded object.
  *
  * @param   ResourceEmbedded  $resource  An embedded resources object.
  *
  * @return  A representation of the object.
  */
 public function renderResourceEmbedded(ResourceEmbedded $resource)
 {
     $data = array();
     foreach ($resource->getResources() as $rel => $resources) {
         if (is_array($resources)) {
             foreach ($resources as $resource) {
                 $data[$rel][] = json_decode($this->render($resource));
             }
         } else {
             $data[$rel] = $this->render($resources);
         }
     }
     return $data;
 }