コード例 #1
0
 /**
  * Creates payload structure for HATEOAS link
  *
  * @param string rel
  * @param string target
  * @param array parameters
  *
  * @return array
  * @throws Nette\InvalidArgumentException
  */
 public function hateoasLink($rel = 'self', $target = NULL, array $params = array())
 {
     list($class, $method) = $this->parseLinkTarget($target);
     list($httpMethod, $path, $addtionalParams) = $this->presenter->requestRouter->createUrl($class, $method, $params);
     return array('rel' => $rel, 'href' => $this->presenter->link($path, $addtionalParams), 'method' => $httpMethod);
 }