|
@@ -61,6 +61,21 @@ class CRUDController extends Controller
|
|
|
return $this->get('request')->isXmlHttpRequest() || $this->get('request')->get('_xml_http_request');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Returns the correct RESTful verb, given either by the request itself or
|
|
|
+ * via the "_method" parameter.
|
|
|
+ *
|
|
|
+ * @return string HTTP method, either
|
|
|
+ */
|
|
|
+ protected function getRestMethod()
|
|
|
+ {
|
|
|
+ $request = $this->getRequest();
|
|
|
+ if(Request::getHttpMethodParameterOverride() || !$request->request->has('_method')) {
|
|
|
+ return $request->getMethod();
|
|
|
+ }
|
|
|
+ return $request->request->get('_method');
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Sets the Container associated with this Controller.
|
|
|
*
|
|
@@ -211,7 +226,7 @@ class CRUDController extends Controller
|
|
|
throw new AccessDeniedException();
|
|
|
}
|
|
|
|
|
|
- if ($this->getRequest()->getMethod() == 'DELETE') {
|
|
|
+ if ($this->getRestMethod() == 'DELETE') {
|
|
|
try {
|
|
|
$this->admin->delete($object);
|
|
|
|