PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 14, 2022

[FIXED] Point cakephp 3 model to a different table

 January 14, 2022     cakephp, cakephp-3.0, model     No comments   

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
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing