Routing redirects in CakePHP 4.2

I’m updating a web site I maintain and some of the routes have changed. In particular I have routes that were /development/development-name that will be /developments/view/development-name (where there are a number of different development-names).

It looks like the RouteBuilder redirect should be able to do what I want (see api for routebuilder redirect).

I’ve tried a number of different variations on getting this to work. The latest looks something like this but the redirect always fails with the value of n never being passed.

$routes->scope('/', function (RouteBuilder $builder) {
        $builder->redirect('/development/{n}', ['controller' => 'Developments', 'action' => 'view'], ['persist' => ['n']]);
        $builder->connect('/developments/view/{n}', ['controller' => 'Developments', 'action' => 'view'], ['pass' => ['n']]);


Can anybody advise on what form this should be taking?

In the time honoured tradition of these things I made one last attempt to get this to work minutes after posting the question and discovered the answer. It seems like the correct form for the redirect line is -

$builder->redirect('/development/{n}', ['controller' => 'Developments', 'action' => 'view'], ['persist' => true, 'pass' => ['n']]);