Development

- Removed yet another depricated method.
- Fixed $_GET parameters being merged on default when calling getUrl.
- Fixed double / that could appear on urls sometimes.
This commit is contained in:
Simon Sessingø
2016-11-21 03:05:43 +01:00
parent 5415d73f4d
commit efe5767220
3 changed files with 3 additions and 28 deletions

View File

@@ -103,7 +103,7 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
}
}
$url .= '/' . join('/', $unknownParams);
$url .= join('/', $unknownParams);
return rtrim($url, '/') . '/';
}

View File

@@ -384,7 +384,7 @@ class Router
* @param array|null $getParams
* @return string
*/
public function getUrl($name = null, $parameters = null, array $getParams = null)
public function getUrl($name = null, $parameters = null, $getParams = [])
{
if ($getParams !== null && is_array($getParams) === false) {
throw new \InvalidArgumentException('Invalid type for getParams. Must be array or null');

View File

@@ -306,37 +306,12 @@ class SimpleRouter
* You can also use the same syntax when searching for a specific controller-class "MyController@home".
* If no arguments is specified, it will return the url for the current loaded route.
*
* This method is an alias for SimpleRouter::getUrl().
*
* @see SimpleRouter::getUrl()
* @param string|null $name
* @param string|array|null $parameters
* @param array|null $getParams
* @return string
*/
public static function getRoute($name = null, $parameters = null, array $getParams = null)
{
return static::getUrl($name, $parameters, $getParams);
}
/**
* Get url for a route by using either name/alias, class or method name.
*
* The name parameter supports the following values:
* - Route name
* - Controller/resource name (with or without method)
* - Controller class name
*
* When searching for controller/resource by name, you can use this syntax "route.name@method".
* You can also use the same syntax when searching for a specific controller-class "MyController@home".
* If no arguments is specified, it will return the url for the current loaded route.
*
* @param string|null $name
* @param string|array|null $parameters
* @param array|null $getParams
* @return string
*/
public static function getUrl($name = null, $parameters = null, array $getParams = null)
public static function getUrl($name = null, $parameters = null, $getParams = [])
{
return static::router()->getUrl($name, $parameters, $getParams);
}