烘焙的其他常见操作

时间:2015-05-08 18:21:04

标签: cakephp cakephp-3.0 cakephp-bake

除了索引,查看,添加,编辑,删除之外,还有什么更好的方法来烘焙其他常见操作(如启用,上移,移动等)?我在手册中遗漏了一些技巧吗?或者正确的方法是通过制作分支来修改CAKE / vendor / cakephp / bake / src / Shell / Task / ControllerTask.php?

1 个答案:

答案 0 :(得分:2)

在irc.freenode.net的#cakeph chanell的jose_zap建议和一些实验后,我找到了解决方案。

1)复制

APP/vendor/cakephp/bake/src/Template/Bake/Controller/controller.ctp

到我的插件

APP/plugins/MY_PLUGIN/src/Template/Bake/Controller/controller.ctp

2)修改以下行(注释并添加我自己的注释原始动作):

//  foreach($actions as $action) {
//    echo $this->element('Controller/' . $action);
//  }

    $themeActions = ['index', 'view', 'add', 'edit', 'delete', 'moveup','movedown', 'recover', 'enable', 'disable', 'copy'];
    foreach($themeActions as $action) {
        echo $this->element($this->theme.'.Controller/' . $action);
    }

3)从

复制所有文件
APP/vendor/cakephp/bake/src/Template/Bake/Element/Controller/*

APP/plugins/Tools/src/Template/Bake/Element/Controller/*

并添加我自己的操作(例如' moveup',' moveown',' recover',' enable','禁用','复制'等等)

那'所有

相关问题