Friday, January 14, 2022

[FIXED] Point cakephp 3 model to a different table

Issue

For database organisation purposes, I have added pretext for every table. I would then name models in Cakephp without the pretext, for less writing when calling them.

In Cakephp 2 I would use public $useTable = 'dev_pictures'; to point "Picture" model to "dev_pictures" table, in Cakephp 3, this has no effect. How would i do it in Cakephp 3?


Solution

Why not simply reading the migration guide?

It's now Table::table(), the method is a getter and setter. Set the table name in your tables initialize() method.



Answered By - floriank

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.