Monday, September 8, 2014

Re: CakePHP 3 controller with prefix

Probaly this one : http://book.cakephp.org/3.0/en/development/routing.html#route-elements

CakePHP does not automatically produce lowercased urls when using the :controller parameter. If you need this, the above example could be rewritten like so:

The special class will make sure that the :controller and :plugin parameters are correctly lowercased.

Andras


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

> Great, that's it!
> I just didn't understand it... Isn't it the default cake behavior about controller's filenames (CamelcasedController.php) ?
> If so I think it shouldn't be necessary to configure the prefix route to behave like this.
> Anyway thanks for your reply, it's working now.
>
>
> Em segunda-feira, 8 de setembro de 2014 19h21min46s UTC-3, Andras Kende escreveu:
>
> 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 <tiag...@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+u...@googlegroups.com.
>> To post to this group, send email to cake...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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.

--
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: