0

I am having issues trying to bake a table I created in my database. I am on Windows 10 and as you can see below, running php 5.5.12 (which is higher than the required 5.5.9 or greater). I am also running cake version 3.2.6.

I originally had a field in the table named comment which I saw was a reserved word for mySql. I then changed it to content. Would it be that my table name is comments? I wouldn't think that would cause a conflict.

I do not know why this is happening or how to solve any thoughts?

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}
Battousai
  • 503
  • 7
  • 17
  • Is your database name `utahreia3.x` by any chance? – ndm Apr 06 '16 at 17:04
  • Lol... yes, so you think the .x is throwing the error? Because I have baked to this database before, granted it was with an older version of cake. – Battousai Apr 06 '16 at 17:07
  • 1
    I would think so, given that the error message says "_... near ``'.`x`'``_". The identifier quoting mechnism used by Cake cannot account for database name needs, as it doesn't know what the passed value is going to be used for, it will treat `x.y` patterns as alias and column, and quote it as ```x`.`y``` (including surrounding backticks, SO swallows them). That's something that might need some fixing, given that it's something that should be supported. – ndm Apr 06 '16 at 17:14
  • @ndm Well sir, in the words of Chris Farley "that is correct". Thanks for the help. – Battousai Apr 06 '16 at 17:24

0 Answers0