2

What I have done is use Library::locate to find controllers, calling Router::match on them based on a whitelist property. I also have a shared controller that many models use and I use locate on models with a whitelist there. This is sort of working, but I run into trouble trying to reverse route and get 'No parameter match found' exception. For instance the example below. So if you do not have a good answer for the big one, do you know why this route match fails?

Router::connect(
    '/api/3/vouchers/{:id}/{:action:(handout|generate|give)}',
    array('http:method' => 'POST', 'controller' => 'Vouchers', 'type' => 'json')
);

$result = Router::match(array(
    'controller'=>'Vouchers',
    'action'=>'generate',
    'id' => '{:id}', // *
    'http:method' => 'POST',
    'type'=>'json'
));

*: The reason I use {:id} as the value for id is that I wish to display the route, not create a link.

Charles
  • 50,943
  • 13
  • 104
  • 142
Alexander Morland
  • 6,356
  • 7
  • 32
  • 51

0 Answers0