FEATURE: Allow access to the live site via RESTful api

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@72517 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-03-05 21:11:03 +00:00 committed by Sam Minnee
parent a1e48eff8e
commit 9919f5383e
4 changed files with 20 additions and 4 deletions

View File

@ -25,6 +25,7 @@ Director::addRules(10, array(
'$Controller//$Action/$ID/$OtherID' => '*',
'images' => 'Image_Uploader',
'' => 'RootURLController',
'api/v1/live' => 'VersionedRestfulServer',
'api/v1' => 'RestfulServer',
'soap/v1' => 'SOAPModelAccess',
'dev' => 'DevelopmentAdmin'

View File

@ -457,7 +457,7 @@ class RestfulServer extends Controller {
*/
protected function getObjectQuery($className, $id, $params) {
$baseClass = ClassInfo::baseDataClass($className);
return singleton($className)->buildSQL(
return singleton($className)->extendedSQL(
"`$baseClass`.ID = {$id}"
);
}

View File

@ -0,0 +1,15 @@
<?php
/**
* Simple wrapper to allow access to the live site via REST
*/
class VersionedRestfulServer extends Controller {
function handleRequest($request) {
Versioned::reading_stage('Live');
$restfulserver = new RestfulServer();
$response = $restfulserver->handleRequest($request);
return $response;
}
}
?>

View File

@ -108,7 +108,7 @@ class SearchContext extends Object {
if($existingQuery) {
$query = $existingQuery;
} else {
$query = $model->buildSQL();
$query = $model->extendedSQL();
}
$SQL_limit = Convert::raw2sql($limit);