Cakephp 2.1 naming convensions issue in version change

我的梦境 提交于 2019-12-04 05:48:15

问题


I have just installed CakePHP 2.1. And just see that the naming convention of its is just change lot from the older version which making me crazy.

Like it was app/controllers while now it is app/Controller same way

app/models - app/Model

app/views - app/View

I know there must be some advantage on doing this. But my problem is when I use the cake bake it is creating directory in the same old fashion i.e. controllers/models/views. Which is no more accessible from the URL & obviously will throw an error.

Is anyone there who has face the same issue ? Is there any solution that cake bake also use the same conventions ?

Any help will be appreciate. Thanks.


回答1:


you can always use explicit paths:

/path/to/app_dir>..\lib\Cake\Console\cake bake

from your APP dir of the current cake project. this is foolprove and always works with the right cake version.

I do it this way and use a shortcut on my keyboard to print this (up to "cake") on a single key stroke.




回答2:


The reason for the change is to be able to better autoload files based on their kind (using App::uses('User', 'Model'); and later , when namespaces are introduced (3.0?) they can be loaded a lot more easy because you will call a class then like for example: "new \Cake\Model\User();"

About your bake problem: Make sure your environment is pointing to the correct "cake" shell file. I'm pretty sure yours is still pointing to the old 1.3 "cake" shell.



来源:https://stackoverflow.com/questions/9715480/cakephp-2-1-naming-convensions-issue-in-version-change

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