Skip to content

Instantly share code, notes, and snippets.

@brendo
Last active August 29, 2015 14:15
Show Gist options
  • Save brendo/a493d37fdb033c4edb04 to your computer and use it in GitHub Desktop.
Save brendo/a493d37fdb033c4edb04 to your computer and use it in GitHub Desktop.
Symfony Routing bug?
<?php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
$masterRoutes = new RouteCollection();
$routesA = new RouteCollection();
$routesA->add('hello', new Route('/hello', array('controller' => 'foo')));
$routesA->addPrefix('/a/');
$routesB = new RouteCollection();
$routesB->add('hello', new Route('/hello', array('controller' => 'foo')));
$routesB->addPrefix('/b/');
$masterRoutes->addCollection($routesA);
$masterRoutes->addCollection($routesB);
var_dump($masterRoutes->all());exit;
@ad3n
Copy link

ad3n commented Feb 11, 2015

<?php

require __DIR__ . '/vendor/autoload.php';

use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

$masterRoutes = new RouteCollection();

$routesA = new RouteCollection();
$routesA->add('helloa', new Route('/hello', array('controller' => 'foo')));
$routesA->addPrefix('/a/');

$routesB = new RouteCollection();
$routesB->add('hellob', new Route('/hello', array('controller' => 'foo')));
$routesB->addPrefix('/b/');

$masterRoutes->addCollection($routesA);
$masterRoutes->addCollection($routesB);

var_dump($masterRoutes->all());exit;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment