dtrt2368 2012-07-06 06:46
浏览 21
已采纳

Cakephp表的不同后缀

I have the following requirement:

to create db tables with the names like:

topics_group1

topics_group2

topics_group3

topics_group4

Is there any way to create model "TopicsGroup" and associate that with different table names based on suffix in cakephp?

P.S. please do NOT suggest to create different table for groups and another table to map group & topics. Thanks

  • 写回答

1条回答 默认 最新

  • duangou2028 2012-07-10 20:28
    关注

    in the model you should have:

    class TopicsGroup extends Model{
        public $useTable = 'topics_group1';
    }
    

    but I don't know how to dynamically change the suffix in a Cake way, you could just have 3 Models(TopicsGroup1 ...)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端