cakephp/ cakedc routes and urls

195 views Asked by At

I'm using CakePHP3 with CakeDC, and setup my routes like this:

/* config/routes.php */
Router::prefix('Customers', function($routes) {
    $routes->connect('/',  ['controller' => 'Dashboard', 'action' => 'index']);
    $routes->fallbacks('DashedRoute');
});

/* vendor/cakedc/users/config/routes.php */
Router::plugin('CakeDC/Users', ['path' => '/customers'], function ($routes) {
    $routes->connect('/users/:action', ['controller' => 'Users'], ['routeClass' => 'DashedRoute']);
    $routes->connect('/users/:action/*', ['controller' => 'Users'], ['routeClass' => 'DashedRoute']);
    $routes->fallbacks('DashedRoute');
});

The routes are both loaded.

Basically all URLs have the prefix Customers, like www.url.com/customers/dashboard

With this routes I can access the profile by going to www.url.com/customers/users/profile. Which is working fine.

In my default layout I want to create a link to the page, so I've used:

$this->Html->link('Profile', ['plugin'=>'CakeDC/Users', 'controller' => 'Users', 'action'=>'Profile']);

Which leads to this error:

Error: A route matching "array ( 'plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'Profile', '_ext' => NULL, )" could not be found.

I've tried adding the customer prefix, but still the error exists.

What am I overseeing here?

0

There are 0 answers