gpt4 book ai didi

php - CakePHP v3.x 如何在没有数据库连接的情况下烘焙

转载 作者:可可西里 更新时间:2023-10-31 23:46:42 25 4
gpt4 key购买 nike

我正在使用 CakePHP v3.x,我的应用程序没有任何模型,但我想支持几个 View 或 Controller 。

$ bin/cake bake 模板报告

我试过:* 使用带有 false 或空字符串的 --connection 选项* 从 app.php 中删除 Datasources* 保留 Datasources 但将 Datasources['default'] 设置为 false

所有这些都会导致错误:

Welcome to CakePHP v3.1.2 Console
---------------------------------------------------------------
App : src
Path: /Applications/MAMP/htdocs/listings/src/
PHP : 5.6.10
---------------------------------------------------------------
Exception: The datasource configuration "default" was not found. in [/Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php, line 187]
2015-10-22 02:30:48 Error: [Cake\Datasource\Exception\MissingDatasourceConfigException] The datasource configuration "default" was not found.
Exception Attributes: array (
'name' => 'default',
)
Stack Trace:
#0 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php(164): Cake\Datasource\ConnectionManager::get('default')
#1 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/ORM/TableRegistry.php(109): Cake\ORM\Locator\TableLocator->get('Reports', Array)
#2 /Applications/MAMP/htdocs/listings/vendor/cakephp/bake/src/Shell/Task/TemplateTask.php(282): Cake\ORM\TableRegistry::get('Reports')
#3 /Applications/MAMP/htdocs/listings/vendor/cakephp/bake/src/Shell/Task/TemplateTask.php(147): Bake\Shell\Task\TemplateTask->_loadController()
#4 [internal function]: Bake\Shell\Task\TemplateTask->main('Reports')
#5 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/Shell.php(447): call_user_func_array(Array, Array)
#6 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/Shell.php(442): Cake\Console\Shell->runCommand(Array, false)
#7 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(212): Cake\Console\Shell->runCommand(Array, true, Array)
#8 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(179): Cake\Console\ShellDispatcher->_dispatch(Array)
#9 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(126): Cake\Console\ShellDispatcher->dispatch(Array)
#10 /Applications/MAMP/htdocs/listings/bin/cake.php(33): Cake\Console\ShellDispatcher::run(Array)
#11 {main}

最佳答案

我怀疑这是否会很快奏效。您可以在 Github 上创建功能请求类型票证,但这不太可能发生,因为 bake 使用 DB schema 读取字段并基于 schema 构建所有内容。

还有 Table 类,它取代了 Cake2 中的 Model,不再允许 $useTable = false。因为一张表需要一张DB表。对于无模型形式 see this link .

关于php - CakePHP v3.x 如何在没有数据库连接的情况下烘焙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33272455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com