CakePHP specify table-name

前端 未结 2 1713
暗喜
暗喜 2021-01-19 15:03

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

相关标签:
2条回答
  • 2021-01-19 15:46

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

    $useTable = 'yourtablename'
    

    Although, as Wooble noted, your doubts are wrong.

    0 讨论(0)
  • Cakephp 3, use this instead:

    https://book.cakephp.org/3.0/en/orm/table-objects.html

    class MyTable extends Table
    {
        public function initialize(array $config)
        {
            parent::initialize($config);
            $this->setTable('my_table');
            $this->setAlias('MyTable');
        }
    }
    
    0 讨论(0)
提交回复
热议问题