Failure on using MsSQL


#1

I am developing a system using mssql. Now I have successfully connected to the sql server. However, I failed to bake models. Here is the code.

Blockquote
D:\webroot\exam>php bin/cake.php bake model sf
Deprecated Error: ConsoleOptionParser::description() is deprecated. Use ConsoleO
ptionParser::setDescription()/getDescription() instead. - D:\webroot\exam\vendor
\cakephp\migrations\src\Shell\Task\SimpleMigrationTask.php, line: 141 in [D:\web
root\exam\vendor\cakephp\cakephp\src\Core\functions.php, line 305]
Deprecated Error: ConsoleOptionParser::description() is deprecated. Use ConsoleO
ptionParser::setDescription()/getDescription() instead. - D:\webroot\exam\vendor
\cakephp\migrations\src\Shell\Task\SimpleMigrationTask.php, line: 141 in [D:\web
root\exam\vendor\cakephp\cakephp\src\Core\functions.php, line 305]
Deprecated Error: ConsoleOptionParser::description() is deprecated. Use ConsoleO
ptionParser::setDescription()/getDescription() instead. - D:\webroot\exam\vendor
\cakephp\migrations\src\Shell\Task\MigrationSnapshotTask.php, line: 135 in [D:\w
ebroot\exam\vendor\cakephp\cakephp\src\Core\functions.php, line 305]
Deprecated Error: ConsoleOptionParser::description() is deprecated. Use ConsoleO
ptionParser::setDescription()/getDescription() instead. - D:\webroot\exam\vendor
\cakephp\migrations\src\Shell\Task\SimpleMigrationTask.php, line: 141 in [D:\web
root\exam\vendor\cakephp\cakephp\src\Core\functions.php, line 305]
Deprecated Error: ConsoleOptionParser::description() is deprecated. Use ConsoleO
ptionParser::setDescription()/getDescription() instead. - D:\webroot\exam\vendor
\cakephp\migrations\src\Shell\Task\SeedTask.php, line: 152 in [D:\webroot\exam\v
endor\cakephp\cakephp\src\Core\functions.php, line 305]
One moment while associations are detected.
Deprecated Error: Connection::schemaCollection() is deprecated. Use Connection::
setSchemaCollection()/getSchemaCollection() instead. - D:\webroot\exam\vendor\ca
kephp\bake\src\Shell\Task\ModelTask.php, line: 1034 in [D:\webroot\exam\vendor\c
akephp\cakephp\src\Core\functions.php, line 305]
2018-04-07 19:24:29 Notice: Deprecated (16384): Connection::schemaCollection() i
s deprecated. Use Connection::setSchemaCollection()/getSchemaCollection() instea
d. - D:\webroot\exam\vendor\cakephp\bake\src\Shell\Task\ModelTask.php, line: 103
4 in [D:\webroot\exam\vendor\cakephp\cakephp\src\Core\functions.php, line 305]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE\src\Error\BaseErrorHandler.php
, line 153
deprecationWarning - CORE\src\Core\functions.php, line 305
Cake\Database\Connection::schemaCollection() - CORE\src\Database\Connection.php,
line 408
Bake\Shell\Task\ModelTask::_getAllTables() - ROOT\vendor\cakephp\bake\src\Shell
Task\ModelTask.php, line 1034
Bake\Shell\Task\ModelTask::listAll() - ROOT\vendor\cakephp\bake\src\Shell\Task\M
odelTask.php, line 988
Bake\Shell\Task\ModelTask::getAssociations() - ROOT\vendor\cakephp\bake\src\Shel
l\Task\ModelTask.php, line 212
Bake\Shell\Task\ModelTask::getTableContext() - ROOT\vendor\cakephp\bake\src\Shel
l\Task\ModelTask.php, line 130
Bake\Shell\Task\ModelTask::bake() - ROOT\vendor\cakephp\bake\src\Shell\Task\Mode
lTask.php, line 113
Bake\Shell\Task\ModelTask::main() - ROOT\vendor\cakephp\bake\src\Shell\Task\Mode
lTask.php, line 100
Cake\Console\Shell::runCommand() - CORE\src\Console\Shell.php, line 532
Cake\Console\Shell::runCommand() - CORE\src\Console\Shell.php, line 525
Cake\Console\CommandRunner::runShell() - CORE\src\Console\CommandRunner.php, lin
e 339
Cake\Console\CommandRunner::run() - CORE\src\Console\CommandRunner.php, line 161
[main] - ROOT\bin\cake.php, line 12
Exception: Cannot describe sf. It has 0 columns. in [D:\webroot\exam\vendor\cake
php\cakephp\src\Database\Schema\Collection.php, line 99]
2018-04-07 19:24:29 Error: [Cake\Database\Exception] Cannot describe sf. It has
0 columns. in D:\webroot\exam\vendor\cakephp\cakephp\src\Database\Schema\Collect
ion.php on line 99
Stack Trace:
#0 D:\webroot\exam\vendor\cakephp\cakephp\src\Database\Schema\CachedCollection.p
hp(63): Cake\Database\Schema\Collection->describe(‘sf’, Array)
#1 D:\webroot\exam\vendor\cakephp\cakephp\src\ORM\Table.php(548): Cake\Database
Schema\CachedCollection->describe(‘sf’)
#2 D:\webroot\exam\vendor\cakephp\cakephp\src\ORM\Table.php(673): Cake\ORM\Table
->getSchema()
#3 D:\webroot\exam\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(220): Cake\O
RM\Table->getPrimaryKey()
#4 D:\webroot\exam\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(130): Bake\S
hell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
#5 D:\webroot\exam\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(113): Bake\S
hell\Task\ModelTask->getTableContext(Object(Cake\ORM\Table), ‘sf’, ‘Sf’)
#6 D:\webroot\exam\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(100): Bake\S
hell\Task\ModelTask->bake(‘Sf’)
#7 D:\webroot\exam\vendor\cakephp\cakephp\src\Console\Shell.php(532): Bake\Shell
\Task\ModelTask->main(‘sf’)
#8 D:\webroot\exam\vendor\cakephp\cakephp\src\Console\Shell.php(525): Cake\Conso
le\Shell->runCommand(Array, false, Array)
#9 D:\webroot\exam\vendor\cakephp\cakephp\src\Console\CommandRunner.php(339): Ca
ke\Console\Shell->runCommand(Array, true)
#10 D:\webroot\exam\vendor\cakephp\cakephp\src\Console\CommandRunner.php(161): C
ake\Console\CommandRunner->runShell(Object(Bake\Shell\BakeShell), Array)
#11 D:\webroot\exam\bin\cake.php(12): Cake\Console\CommandRunner->run(Array)
#12 {main}

I am sure the table ‘sf’ is existed, and it has many columns. Who can help me?


#2

What does your database config look like?


#3

Thank you for your reply. I have solved the problem. I forgot to give enough admission to the sql account.