summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Routing
diff options
context:
space:
mode:
authorLee Rowlands2018-01-14 22:50:15 (GMT)
committerLee Rowlands2018-01-14 22:50:15 (GMT)
commitb4a02309bf739ae16ceedda3ff3a181d9a3a9b82 (patch)
tree4045e7b722325d5fab15260cbd17076e8b7445dc /core/lib/Drupal/Core/Routing
parent3d67ae3016d8b2fac6ee8044ea7958e590af0912 (diff)
Issue #2858482 by Wim Leers, dawehner, benjy, larowlan, tedbow, borisson_: Simplify REST routing: disallow requesting POST/PATCH in any format, make consistent
Diffstat (limited to 'core/lib/Drupal/Core/Routing')
-rw-r--r--core/lib/Drupal/Core/Routing/BcRoute.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/lib/Drupal/Core/Routing/BcRoute.php b/core/lib/Drupal/Core/Routing/BcRoute.php
new file mode 100644
index 0000000..e6a7658
--- /dev/null
+++ b/core/lib/Drupal/Core/Routing/BcRoute.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\Core\Routing;
+
+use Symfony\Component\Routing\Route;
+
+/**
+ * A backwards compatibility route.
+ *
+ * When a route is deprecated for another one, and backwards compatibility is
+ * provided, then it's best practice to:
+ * - not duplicate all route definition metadata, to instead have an "as empty
+ * as possible" route
+ * - have an accompanying outbound route processor, that overwrites this empty
+ * route definition with the redirected route's definition.
+ *
+ * @see \Drupal\rest\RouteProcessor\RestResourceGetRouteProcessorBC
+ */
+class BcRoute extends Route {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct() {
+ parent::__construct('');
+ $this->setOption('bc_route', TRUE);
+ }
+
+}