0

当我尝试烘焙某些视图和控制器时,我似乎遇到了一些神秘的错误。模型烤得很好(一个模型因类似的消息构建测试而死亡),所有控制器都烤得很好,但其中一个带有以下错误消息:

Error: `stream` not a ConsoleOutput nor string
#0 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Log/LogEngineCollection.php(43): ConsoleLog->__construct(Array)
#1 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Log/CakeLog.php(199): LogEngineCollection->load('stdout', Array)
#2 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Shell.php(841): CakeLog::config('stdout', Array)
#3 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Shell.php(176): Shell->_useLogger()
#4 [internal function]: Shell->__construct(Array)
#5 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Utility/ClassRegistry.php(168): ReflectionClass->newInstance(Array)
#6 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Model/Model.php(1032): ClassRegistry::init(Array)
#7 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Model/Model.php(858): Model->_constructLinkedModel('Projecttask', 'Projecttask', NULL)
#8 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Model/Model.php(888): Model->__isset('Projecttask')
#9 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(459): Model->__get('Projecttask')
#10 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(285): ViewTask->_associations(Object(Project))
#11 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(224): ViewTask->_loadController()
#12 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(91): ViewTask->_interactive()
#13 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(111): ViewTask->execute()
#14 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#15 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#16 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#17 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#18 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#19 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#20 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#21 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#22 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#23 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#24 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#25 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#26 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#27 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#28 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#29 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#30 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#31 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#32 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#33 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#34 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#35 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#36 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#37 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#38 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#39 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#40 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#41 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#42 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#43 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#44 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(132): BakeShell->main()
#45 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Shell.php(392): BakeShell->main()
#46 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/ShellDispatcher.php(200): Shell->runCommand(NULL, Array)
#47 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/ShellDispatcher.php(68): ShellDispatcher->dispatch()
#48 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/cake.php(50): ShellDispatcher::run(Array)
#49 {main}

当我为以前烘焙的模型和控制器烘焙视图时,我得到:

Error: `stream` not a ConsoleOutput nor string
#0 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Log/LogEngineCollection.php(43): ConsoleLog->__construct(Array)
#1 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Log/CakeLog.php(199): LogEngineCollection->load('stdout', Array)
#2 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Shell.php(841): CakeLog::config('stdout', Array)
#3 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Shell.php(176): Shell->_useLogger()
#4 [internal function]: Shell->__construct(Array)
#5 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Utility/ClassRegistry.php(168): ReflectionClass->newInstance(Array)
#6 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Model/Model.php(1032): ClassRegistry::init(Array)
#7 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Model/Model.php(858): Model->_constructLinkedModel('Projecttask', 'Projecttask', NULL)
#8 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Model/Model.php(888): Model->__isset('Projecttask')
#9 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(459): Model->__get('Projecttask')
#10 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(285): ViewTask->_associations(Object(Projecttasknote))
#11 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(224): ViewTask->_loadController()
#12 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/Task/ViewTask.php(91): ViewTask->_interactive()
#13 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Command/BakeShell.php(111): ViewTask->execute()
#14 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/Shell.php(392): BakeShell->main()
#15 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/ShellDispatcher.php(200): Shell->runCommand(NULL, Array)
#16 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/ShellDispatcher.php(68): ShellDispatcher->dispatch()
#17 /var/www/vhosts/raccoon/cakephp-cakephp-f02bc38/lib/Cake/Console/cake.php(50): ShellDispatcher::run(Array)
#18 {main}

它非常神秘,如果有人能告诉我在哪里看,那就太好了。我正在使用最新最好的蛋糕版本(2.3.5)

谢谢

4

2 回答 2

0

啊。CakePHP 2 是垃圾。CakePHP 1.3 要好得多,似乎可以工作,并且不会在文件夹结构上使用愚蠢的大写字母。

于 2013-06-06T06:38:22.777 回答
0

我遇到了同样的问题,花了 2 个小时调试它。你似乎犯了和我一样的错误。

CakePHP 2 的模型构造通过调用它的模型实例来工作\ReflectionClass。但是,CakePHP 2 不使用名称空间。

这里发生的情况如下:CakePHP 2 已经有一个名为ProjectTaskin的类/lib/Cake/Console/Command/Task/ProjectTask.php。您命名了您的模型之一Projecttask,因此当ReflectionClass尝试调用您的Projecttask模型时,它会意外调用 Cake 的内部ProjectTaskshell 任务,该任务需要一个流参数,而是获取您的模型classalias参数。

所以基本上,将您的Projecttask模型重命名为其他名称。此外,命名空间也很棒。

于 2016-02-24T15:21:51.653 回答