Skip to content

Commit

Permalink
Merge pull request #12 from ruebot/issue-302
Browse files Browse the repository at this point in the history
  • Loading branch information
whikloj authored Jul 22, 2016
2 parents 22e0c0e + 2cd2a2f commit 0d9d048
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/ResourceService/Controller/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,19 @@ public function get(Application $app, Request $request, $id, $child)

/**
* Resource POST route controller. takes $id (valid UUID or empty) for the parent resource as first value to match
* takes 'rx' and/or 'checksum' as optional query arguments
* takes 'rx' as an optional query arguments
*
* @see https://wiki.duraspace.org/display/FEDORA4x/RESTful+HTTP+API (Create new resources within a LDP container)
*/
public function post(Application $app, Request $request, $id)
{
$tx = $request->query->get('tx', "");
$checksum = $request->query->get('checksum', "");
try {
$response = $app['api']->createResource(
$app->escape($id),
$request->getContent(),
$request->headers->all(),
$tx,
$checksum
$tx
);
} catch (\Exception $e) {
$app->abort(
Expand All @@ -69,21 +67,19 @@ public function post(Application $app, Request $request, $id)
/**
* Resource PUT route. takes $id (valid UUID or empty) for the resource to be update/created
* as first value to match, optional a Child resource relative path
* takes 'rx' and/or 'checksum' as optional query arguments
* takes 'rx' as an optional query arguments
*
* @see https://wiki.duraspace.org/display/FEDORA4x/RESTful+HTTP+API (Create a resource with a specified path...)
*/
public function put(Application $app, Request $request, $id, $child)
{
$tx = $request->query->get('tx', "");
$checksum = $request->query->get('checksum', "");
try {
$response = $app['api']->saveResource(
$app->escape($id) . '/' . $child,
$request->getContent(),
$request->headers->all(),
$tx,
$checksum
$tx
);
} catch (\Exception $e) {
$app->abort(503, '"Chullo says Fedora4 Repository is Not available"');
Expand Down Expand Up @@ -117,7 +113,7 @@ public function patch(Application $app, Request $request, $id, $child)

/**
* Resource DELETE route controller. takes $id (valid UUID) for the parent resource as first value to match
* takes 'rx' and/or 'checksum' as optional query arguments
* takes 'rx' as an optional query arguments
* @see https://wiki.duraspace.org/display/FEDORA40/RESTful+HTTP+API#RESTfulHTTPAPI-RedDELETEDeletearesource
* @todo check for transaction and create one if empty.
* @todo test with the force.
Expand Down

0 comments on commit 0d9d048

Please sign in to comment.