Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP specify table-name

Tags:

cakephp

I have a table called entries with an associated model called Entry. I stepped through the Blog-tutorial on the CakePHP website. It states that the table-name does not need to be specified because it is computed from the models name. ( Post => posts).

I doubt CakePHP knows that Entry is a non-conform noun when it comes to its plural form. So how can I set the table my model uses? I think CakePHP would otherwise try to access the table entrys.

like image 787
Niklas R Avatar asked Dec 04 '22 14:12

Niklas R


1 Answers

The answer to your question is to specify it inside your model.

$useTable = 'yourtablename'

Although, as Wooble noted, your doubts are wrong.

like image 163
Ben Wilson Avatar answered Jan 11 '23 17:01

Ben Wilson