Exemplo n.º 1
0
 /**
  * @param $resource
  */
 protected function initializeStack($resource)
 {
     $this->stack = new RequestStack();
     if (is_array($resource) || is_object($resource) && $resource instanceof Collection || is_object($resource) && $resource instanceof QueryResultInterface) {
         foreach ($resource as $singleResource) {
             $resourceUri = $this->resourceMapper->getPublicResourceUri($singleResource);
             $dataIdentifier = $this->resourceMapper->getDataIdentifierForPayload($singleResource);
             $this->stack->push((string) $resourceUri, $dataIdentifier, RequestStack::POSITION_DATACOLLECTION);
         }
     } else {
         $resourceUri = $this->resourceMapper->getPublicResourceUri($resource);
         $dataIdentifier = $this->resourceMapper->getDataIdentifierForPayload($resource);
         $this->stack->push((string) $resourceUri, $dataIdentifier, RequestStack::POSITION_DATA);
     }
 }
Exemplo n.º 2
0
 /**
  * @param $payload
  * @return array
  */
 protected function getDataIdentifierForPayload($payload)
 {
     return $this->resourceMapper->getDataIdentifierForPayload($payload);
 }