cakephp 3.0使用tableprefix? [英] cakephp 3.0 using tableprefix?
本文介绍了cakephp 3.0使用tableprefix?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从cakephp 2应用程序继续,我坚持试图在我的模型中使用$ tablePrefix。
这在Cake 3中仍然可用吗?
Moving on from a cakephp 2 application, I am stuck on trying to use $tablePrefix in my models. Is this still available in Cake 3? Or how can I use something else (please explain).
推荐答案
要获得每个表格的前缀,就像在 2.x
只需在您的Table类中执行此操作:
To get prefix per table like you did in 2.x
just do this in your Table class:
public function initialize(array $config) {
$this->table('my_prefix_' . $this->table());
...
}
这篇关于cakephp 3.0使用tableprefix?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文