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' => '*',
|
||||
'images' => 'Image_Uploader',
|
||||
'' => 'RootURLController',
|
||||
'api/v1/live' => 'VersionedRestfulServer',
|
||||
'api/v1' => 'RestfulServer',
|
||||
'soap/v1' => 'SOAPModelAccess',
|
||||
'dev' => 'DevelopmentAdmin'
|
||||
@ -68,4 +69,4 @@ define('MCE_ROOT', 'jsparty/tiny_mce2/');
|
||||
*/
|
||||
define('EMAIL_BOUNCEHANDLER_KEY', '1aaaf8fb60ea253dbf6efa71baaacbb3');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -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}"
|
||||
);
|
||||
}
|
||||
|
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) {
|
||||
$query = $existingQuery;
|
||||
} else {
|
||||
$query = $model->buildSQL();
|
||||
$query = $model->extendedSQL();
|
||||
}
|
||||
|
||||
$SQL_limit = Convert::raw2sql($limit);
|
||||
@ -268,4 +268,4 @@ class SearchContext extends Object {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user