Monday, September 8, 2014

Re: CakePHP 3 controller with prefix


do you have InflectedRoute in your routes ?

Router::prefix('admin', function($routes) {
// All routes here will be prefixed with `/admin`
// And have the prefix => admin route element added.
$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'InflectedRoute']);
$routes->connect('/:controller/:action/*', [], ['routeClass' => 'InflectedRoute']);
});

Andras Kende

On Sep 8, 2014, at 1:00 PM, Tiago Barrionuevo <tiago.bar@gmail.com> wrote:

When I'm using a prefix (admin) I get the following error trying to access '/project/admin/user':

Missing Controller

Error: usersController could not be found.

Error: Create the class usersController below in file: src/Controller/Admin/usersController.php

<?php  namespace App\Controller\Admin;    use App\Controller\AppController;    class usersController extends AppController {    }  


I guess there's a inflection problem in the controller.
This works ok in Windows, but in Linux it only works if I rename the controller from 'UsersController.php' to 'usersController.php'.





--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: