Cakephp Call to Undefined Method Set::numeric()

不想你离开。 提交于 2019-12-11 03:44:39

问题


I am attempting to port a PHP website into cakePHP which is proving somewhat difficult due to a ridiculous amount of incorrectly named columns in the database tables etc. etc.

Anywho, I've gotten most of the way there after renaming many things,and I can bake the entire site without much issue. I can then browse the site normally (the baked version) and everything seems to work on the face of things however there is a table called 'sets' and it seems to cause a problem.

Is there some special reservation for this table name? The issue comes when attempting to utilise the sets controller, ie: site/sets/index or site/sets/add will just return an error saying that it is not defined in the controller, it is. If I then proceed to access any of the other controllers I am met with this error:

Fatal error: Call to undefined method Set::numeric() in /pathtocake/lib/Cake/Model/Datasource/DboSource.php on line 2215

I then usually have to restart mamp to continue!

Can anyone shed any light on this? Thanks


回答1:


set/sets is a protected name for a table and a class. See http://groups.google.com/group/cake-php/msg/8d149a246d46d3cf?pli=1 and http://bakery.cakephp.org/articles/sajt/2007/02/25/cake-conventions

Rename your table to something like mysets.

You can test your schema easily on http://cakeapp.com. This online tools helps you with naming tables correctly and offers cake valid names when a protected name was found.




回答2:


there is cake class Set - therefore you can't have such a model:

@see http://groups.google.com/group/cake-php/browse_thread/thread/f0ef41f705299815/8d149a246d46d3cf for details although pretty old most of it is still true



来源:https://stackoverflow.com/questions/9128298/cakephp-call-to-undefined-method-setnumeric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!