Cake PHP 3.5 Conventions

0

I would like to know if there is a possibility to create a driver in cakePHP 3.5.x that can use a table that is not associated with its name, for example if I want to follow its conventions I create a plural table of students "studens" so that the entity and table of CAKE should follow its sigular / plural conventions, but the controller I want to call students so that the route is understandable for Spanish speakers, since the system will be for them, this sends an error because for That cake data expects you to name the driver studens, there is some way to call it students and have access to the student model.

Greetings and thanks

    
asked by Kung-Fu Panda 10.11.2017 в 22:25
source

2 answers

0

If you want to change the route you can do it from config/routes.php , within the block where the routes are defined you can put your configuration, in this way you can follow the conventions and have the route you need

Router::scope('/', function (RouteBuilder $routes) {
    // Código
    $routes->connect('/alumnos', ['controller' => 'Students', 'action' => 'index']);
});

I suggest you read a bit about 'Routing' in the documentation (English)

    
answered by 10.11.2017 в 23:11
0

Good, you can also create your tables in Spanish, which I do not suggest, and then in your config / bootstrap.php file you add the rules with the static Inflector class.

Custom Inflators

You can also take this tool to get rid of doubts when you are going to generate your tables.

tool of inflectores

But the best way is to create personalized routes like you mentioned Kacos

    
answered by 13.12.2017 в 01:18