cakephp Table for model was not found in datasource default

前端 未结 2 1536
半阙折子戏
半阙折子戏 2021-01-18 16:19

I have just a table on my database named \"ficha_seg\". The name of my model file is \"Ficha.php\" and the name of the controller is \"FichasController.php\".

So, wh

2条回答
  •  情话喂你
    2021-01-18 17:01

    By default, the model uses the lowercase, plural form of the model’s class name for the database table name.

    If you need to use another table name for your model, you can use the useTable attribute:

    class Ficha extends AppModel 
    {
        public $useTable = 'ficha_seg';
    }
    

    See http://book.cakephp.org/2.0/en/models/model-attributes.html#usetable and Model conventions in the Cookbook

提交回复
热议问题