symfony2 - Routing in Silex/Symfony. Providing a default route -
symfony2 - Routing in Silex/Symfony. Providing a default route -
i'm attempting using silex (which uses symfony routing component - reply may applicable symfony well)
i adding silex legacy application provide routing need respect existing applications default implementation loading files (which load file file scheme form url specified).
edit: clarification: existing file loaded file system, include within parent template, after series of bootstrapping calls have been made.
what i'm finding in absence of defined route match legacy pages, silex throwing exception.
i need way provide default (fallback) mechanism handling legacy pages - pattern has match entire url (not 1 fragment).
is possible?
// include silex routing require_once(class_path . 'silex/silex.phar'); // init silex $app = new silex\application(); // route new code // matches new restful interface (like /category/add/mynewcategory) $app->match('/category/{action}/{name}/', function($action, $name){ //do restful things }); // route legacy code (if leave out silex // throws exception beacuse hasn't matched routes $app->match('{match_the_entire_url_including_slashes}', function($match_the_entire_url_including_slashes){ //do legacy stuff }); $app->run();
this must mutual utilize case. i'm trying provide way have restful interface alongside legacy code (load /myfolder/mysubfolder/my_php_script.php)
i found reply within symfony cookbook...
http://symfony.com/doc/2.0/cookbook/routing/slash_in_parameter.html
$app->match('{url}', function($url){ //do legacy stuff })->assert('url', '.+');
symfony2 routing silex
Comments
Post a Comment