Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Patching up routing support.

  • Loading branch information...
commit 01ac59063c85e11fbb1b61ce9973e9d52eb79f68 1 parent 728fac9
Nate Abele authored October 10, 2012
4  action/Resource.php
@@ -100,9 +100,8 @@ protected function _name() {
100 100
 
101 101
 	protected function _method($request, $params) {
102 102
 		$name = $this->_name();
103  
-		$badIndex = ($request->method != 'GET' && $params['action'] == 'index');
104 103
 
105  
-		if (($action = $params['action']) && !$badIndex) {
  104
+		if (($action = $params['action']) && $params['action'] != 'index') {
106 105
 			$methods = array_diff(get_class_methods($this), get_class_methods(__CLASS__));
107 106
 
108 107
 			if (!in_array($action, $methods) || strpos($action, '_') === 0) {
@@ -229,6 +228,7 @@ public function __invoke($request, array $params = array()) {
229 228
 		$classes = $this->_classes;
230 229
 		$params = ($params ?: $request->params) + array('action' => null);
231 230
 		$state = $data = array();
  231
+		$method = null;
232 232
 
233 233
 		$stateMap = array($this->_responder, 'state');
234 234
 		$keyMap = function($obj) { return is_object($obj) ? spl_object_hash($obj) : null; };
4  net/http/Resources.php
@@ -126,6 +126,7 @@ public static function all($resources, array $config, $request) {
126 126
 				if (isset($data[$name])) {
127 127
 					return;
128 128
 				}
  129
+				$resource = is_string($resource) ? array('params' => $resource) : $resource;
129 130
 				$resource += compact('name') + $defaults;
130 131
 				$resource['binding'] = $resource[0];
131 132
 				unset($resource[0]);
@@ -352,7 +353,8 @@ public static function export(array $resources, array $options = array()) {
352 353
 			$remap[$resource] = $config;
353 354
 			$names[] = "[{$first}" . ucfirst($first) . "]" . substr($path, 1);
354 355
 		}
355  
-		$template  = $options['prefix'] . '/{:controller:' . join('|', $names) . '}/{:action}';
  356
+		$template  = $options['prefix'] . '/{:controller:' . join('|', $names) . '}';
  357
+		$template .= '/{:action:[^0-9]+}';
356 358
 		$template .= '/{:id:(?:[0-9a-f]{24})|(?:\d+)}'; //'.{:type}';
357 359
 
358 360
 		return static::_instance('route', compact('template') + array(

0 notes on commit 01ac590

Please sign in to comment.
Something went wrong with that request. Please try again.