0

我在尝试烘焙我在数据库中创建的表时遇到问题。我在 Windows 10 上,如下所示,运行 php 5.5.12(高于所需的 5.5.9 或更高版本)。我也在运行蛋糕版本 3.2.6。

我最初在表中有一个名为 comment 的字段,我看到它是 mySql 的保留字。然后我将其更改为内容。会不会是我的表名是评论?我不认为这会引起冲突。

我不知道为什么会发生这种情况或如何解决任何想法?

c:\wamp\www\utahreia3.x>bin\cake bake all comments

Welcome to CakePHP v3.2.6 Console
---------------------------------------------------------------
App : src
Path: C:\wamp\www\utahreia3.x\src\
PHP : 5.5.12
---------------------------------------------------------------
Bake All
---------------------------------------------------------------
One moment while associations are detected.
Exception: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`x`' at line 1 in [C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Database\Statement\MysqlStatement.php, line 36]
2016-04-06 16:26:19 Error: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`x`' at line 1
Stack Trace:
#0 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Database\Statement\MysqlStatement.php(36): PDOStatement->execute(NULL)
#1 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Database\Connection.php(284): Cake\Database\Statement\MysqlStatement->execute()
#2 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Database\Connection.php(241): Cake\Database\Connection->query('SHOW TABLES FRO...')
#3 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(64): Cake\Database\Connection->execute('SHOW TABLES FRO...', Array)
#4 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(922): Cake\Database\Schema\Collection->listTables()
#5 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(876): Bake\Shell\Task\ModelTask->_getAllTables()
#6 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(198): Bake\Shell\Task\ModelTask->listAll()
#7 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(124): Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
#8 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(109): Bake\Shell\Task\ModelTask->getTableContext(Object(Cake\ORM\Table), 'comments', 'Comments')
#9 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(96): Bake\Shell\Task\ModelTask->bake('Comments')
#10 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\BakeShell.php(250): Bake\Shell\Task\ModelTask->main('Comments')
#11 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Collection\CollectionTrait.php(51): Bake\Shell\BakeShell->Bake\Shell\{closure}('comments', 0)
#12 C:\wamp\www\utahreia3.x\vendor\cakephp\bake\src\Shell\BakeShell.php(253): Cake\Collection\Collection->each(Object(Closure))
#13 [internal function]: Bake\Shell\BakeShell->all('comments')
#14 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Console\Shell.php(444): call_user_func_array(Array, Array)
#15 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(217): Cake\Console\Shell->runCommand(Array, true, Array)
#16 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(181): Cake\Console\ShellDispatcher->_dispatch(Array)
#17 C:\wamp\www\utahreia3.x\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(127): Cake\Console\ShellDispatcher->dispatch(Array)
#18 C:\wamp\www\utahreia3.x\bin\cake.php(33): Cake\Console\ShellDispatcher::run(Array)
#19 {main}
4

0 回答 0