/** * Tested eine Custom Action * * @param int|NULL $id * @return whatever $format is set to */ public function action($id, $resourceName, $format = 'html', $method = 'GET', $data = NULL) { if ($id === NULL) { $url = $this->urlPrefix . '/' . $this->entityMeta->getEntityNamePlural() . '/' . $resourceName; } else { $url = $this->urlPrefix . '/' . $this->entityMeta->getEntityName() . '/' . $id . '/' . $resourceName; } $dispatcher = $this->dispatcher($method, $url); if ($data) { $dispatcher->setRequestData($this->parsePost($data)); } return $this->result($dispatcher, $format); }
public function saves($id) { $this->hasAction($this->getUrlPrefix() . '/' . $this->entityMeta->getEntityName() . '/' . $id); $this->hasMethod('PUT'); return $this; }