Skip to content

Commit

Permalink
Modify Post handler
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed Oct 26, 2013
1 parent 5bcfcfe commit aabac1f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ZfrRest/Mvc/Controller/MethodHandler/PostHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ public function handleMethod(AbstractController $controller, ResourceInterface $

// Set the Location header with the URL of the newly created resource
if (is_object($result)) {
// @TODO: use Router for that
$identifiers = $singleResource->getMetadata()->getClassMetadata()->getIdentifierValues($result);
$url = $controller->url(null, array(reset($identifiers)));

$controller->getResponse()->getHeaders()->addHeaderLine('Location', $url);
}

$controller->getResponse()->setStatusCode(201);
Expand Down

0 comments on commit aabac1f

Please sign in to comment.