Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
8b6f476a
Commit
8b6f476a
authored
Apr 20, 2011
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Routing component
parent
5f356927
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
17 deletions
+14
-17
src/Silex/Application.php
src/Silex/Application.php
+9
-7
src/Silex/Extension/UrlGeneratorExtension.php
src/Silex/Extension/UrlGeneratorExtension.php
+2
-7
src/Silex/RedirectableUrlMatcher.php
src/Silex/RedirectableUrlMatcher.php
+2
-2
vendor/Symfony/Component/Routing
vendor/Symfony/Component/Routing
+1
-1
No files found.
src/Silex/Application.php
View file @
8b6f476a
...
...
@@ -27,6 +27,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
use
Symfony\Component\Routing\Route
;
use
Symfony\Component\Routing\RouteCollection
;
use
Symfony\Component\Routing\RequestContext
;
use
Symfony\Component\Routing\Matcher\Exception\MethodNotAllowedException
;
use
Symfony\Component\Routing\Matcher\Exception\NotFoundException
;
use
Symfony\Component\ClassLoader\UniversalClassLoader
;
...
...
@@ -310,16 +311,17 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
public
function
onCoreRequest
(
KernelEvent
$event
)
{
$this
[
'request'
]
=
$event
->
getRequest
();
$this
[
'request_context'
]
=
new
RequestContext
(
$this
[
'request'
]
->
getBaseUrl
(),
$this
[
'request'
]
->
getMethod
(),
$this
[
'request'
]
->
getHost
(),
$this
[
'request'
]
->
getPort
(),
$this
[
'request'
]
->
getScheme
()
);
$this
[
'controllers'
]
->
flush
();
$matcher
=
new
RedirectableUrlMatcher
(
$this
[
'routes'
],
array
(
'base_url'
=>
$this
[
'request'
]
->
getBaseUrl
(),
'method'
=>
$this
[
'request'
]
->
getMethod
(),
'host'
=>
$this
[
'request'
]
->
getHost
(),
'port'
=>
$this
[
'request'
]
->
getPort
(),
'is_secure'
=>
$this
[
'request'
]
->
isSecure
(),
));
$matcher
=
new
RedirectableUrlMatcher
(
$this
[
'routes'
],
$this
[
'request_context'
]);
$this
[
'dispatcher'
]
->
dispatch
(
Events
::
onSilexBefore
);
...
...
src/Silex/Extension/UrlGeneratorExtension.php
View file @
8b6f476a
...
...
@@ -22,13 +22,8 @@ class UrlGeneratorExtension implements ExtensionInterface
{
$app
[
'url_generator'
]
=
$app
->
share
(
function
()
use
(
$app
)
{
$app
->
flush
();
return
new
UrlGenerator
(
$app
[
'routes'
],
array
(
'base_url'
=>
$app
[
'request'
]
->
getBaseUrl
(),
'method'
=>
$app
[
'request'
]
->
getMethod
(),
'host'
=>
$app
[
'request'
]
->
getHost
(),
'port'
=>
$app
[
'request'
]
->
getPort
(),
'is_secure'
=>
$app
[
'request'
]
->
isSecure
(),
));
return
new
UrlGenerator
(
$app
[
'routes'
],
$app
[
'request_context'
]);
});
}
}
src/Silex/RedirectableUrlMatcher.php
View file @
8b6f476a
...
...
@@ -53,11 +53,11 @@ class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatche
/**
* @see RedirectableUrlMatcherInterface::match()
*/
public
function
redirect
(
$path
info
,
$route
)
public
function
redirect
(
$path
,
$route
,
$scheme
=
null
)
{
return
array
(
'_controller'
=>
function
(
$url
)
{
return
new
RedirectResponse
(
$url
,
301
);
},
'url'
=>
$this
->
context
[
'base_url'
]
.
$pathinfo
,
'url'
=>
$this
->
context
->
getBaseUrl
()
.
$path
,
);
}
}
Routing
@
1740f71d
Subproject commit
46538dba17851bd3b1815cf89076838121b443a2
Subproject commit
1740f71d38056f317b655bdab09e4a666f5bf65b
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment