CakeBake generating invalid Controller

0

I am generating a controller by cakebake based on a table called cliente_planos . It generates controller methods using always $this->ClientePlanos , is generating correctly, but no control method works and I found that they only work if I change to $this->Clienteplanos .

The correct one is $this->ClientePlanos , but I do not know where to set the bake for it to turn the table cliente_planos into $this->ClientePlanos without giving an object error not found.

I'm using cakephp 3 and PHP 5.6.3

    
asked by anonymous 29.08.2016 / 02:43

1 answer

1

This is a problem caused by the differences between our language and English.

In CakePHP who does this naming magic automatically is the Inflector library ( link

a>), it has the internal rules that work very well for the English language, but you will have this type of problem when using some terms in Portuguese, there are some outputs, they are:

1 - work on naming tables in English (this is how the CakePHP conventions command)

2 - Manually instantiate the template in the variable you want (ex: $ ClientPlans), and can even use a property like $ this-> ClientPlans.

3 - Create set of rules of the Portuguese language for Inflector and inject into Cake, so you can use the conventions without having problems of this type.

A strong hug

    
16.09.2016 / 15:49