mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
a1e48eff8e
commit
9919f5383e
@ -25,6 +25,7 @@ Director::addRules(10, array(
|
|||||||
'$Controller//$Action/$ID/$OtherID' => '*',
|
'$Controller//$Action/$ID/$OtherID' => '*',
|
||||||
'images' => 'Image_Uploader',
|
'images' => 'Image_Uploader',
|
||||||
'' => 'RootURLController',
|
'' => 'RootURLController',
|
||||||
|
'api/v1/live' => 'VersionedRestfulServer',
|
||||||
'api/v1' => 'RestfulServer',
|
'api/v1' => 'RestfulServer',
|
||||||
'soap/v1' => 'SOAPModelAccess',
|
'soap/v1' => 'SOAPModelAccess',
|
||||||
'dev' => 'DevelopmentAdmin'
|
'dev' => 'DevelopmentAdmin'
|
||||||
|
@ -457,7 +457,7 @@ class RestfulServer extends Controller {
|
|||||||
*/
|
*/
|
||||||
protected function getObjectQuery($className, $id, $params) {
|
protected function getObjectQuery($className, $id, $params) {
|
||||||
$baseClass = ClassInfo::baseDataClass($className);
|
$baseClass = ClassInfo::baseDataClass($className);
|
||||||
return singleton($className)->buildSQL(
|
return singleton($className)->extendedSQL(
|
||||||
"`$baseClass`.ID = {$id}"
|
"`$baseClass`.ID = {$id}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
15
api/VersionedRestfulServer.php
Normal file
15
api/VersionedRestfulServer.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -108,7 +108,7 @@ class SearchContext extends Object {
|
|||||||
if($existingQuery) {
|
if($existingQuery) {
|
||||||
$query = $existingQuery;
|
$query = $existingQuery;
|
||||||
} else {
|
} else {
|
||||||
$query = $model->buildSQL();
|
$query = $model->extendedSQL();
|
||||||
}
|
}
|
||||||
|
|
||||||
$SQL_limit = Convert::raw2sql($limit);
|
$SQL_limit = Convert::raw2sql($limit);
|
||||||
|
Loading…
Reference in New Issue
Block a user