CakePHP specify table-name

前端 未结 2 1735
暗喜
暗喜 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:54

    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');
        }
    }
    

提交回复
热议问题