I am working on converting a drupal 7 site to drupal 8 for some practice with 8. In my drupal 7 site, I have a custom hook_menu declaration with the following:
function solution_menu() {
$items = array();
$items['solution/%node/%node/%node'] = array(
'title' => '',
'page callback' => 'solution_build_solution',
'page arguments' => array(1,2,3),
'access callback' => 1,
'type' => MENU_CALLBACK,
);
return $items;
}
function solution_build_solution($solution_node, $species_node, $problem_node) {
//build solution
}
I am trying to accomplish the same thing in drupal 8 with a route. However, if I try something like the following i get an error:
wlh_decision.solution:
path: '/solution/{node}/{node}/{node}'
defaults:
_content: '\Drupal\wlh_decision\Controller\SolutionController::displaySolution'
_title: 'Solution:'
_title_callback: '\Drupal\wlh_decision\Controller\SolutionController::solutionTitle'
requirements:
_permission: 'access content'
The error i get is:
LogicException: Route pattern "/solution/{node}/{node}/{node}" cannot reference variable name "node" more than once. in Symfony\Component\Routing\RouteCompiler::compilePattern() (line 106 of /Users/brianwilliams/Sites/MAMP/drupal8/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php).
but if i change it to use names other than node, I don't get the autoloading.
Anybody know how I am able to handle this?