在CakePHP中的模型命名冲突 [英] Model Naming conflict in CakePHP
本文介绍了在CakePHP中的模型命名冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道CakePHP 2.x在名为File.php和CakePHP File类的模型之间是否存在命名冲突?
Does anybody know if CakePHP 2.x has a naming conflict between a Model named File.php and CakePHP File classes?
提前感谢!
推荐答案
是的。有一个实用程序类 File
,并且在CakePHP 2.x中缺少命名空间意味着你不能有第二个类共享同一个名称。您需要为您的模型找到另一个名称,例如 文档
Yes. There's a utility class File
and the lack of namespacing in CakePHP 2.x means you can't have a second class sharing the same name. You will need to find an alternative name for your model, e.g. Document
.
在CakePHP 3.x中,由于使用命名空间,所以这个问题被删除。
In CakePHP 3.x this issue is removed as it uses namespaces.
这篇关于在CakePHP中的模型命名冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文