Wednesday, February 25, 2015

Re: 3.0 Problem with cake bake remplate --connection

The error message is clear, but it's unclear why trying to bake a template ignored the connection i told it to use.

When i execute
> cake bake model --connection admin Listings
The correct connection is used (user kodiak_www_admin is for the admin config)

But when i tried
> cake bake template --connection admin --prefix Admin Listings
The connection didn't use the admin config (user kodiak_www is for the default config, which is what produced the error message in the original post).

Thanks.

-joe


On Wednesday, 25 February 2015 08:41:01 UTC-5, José Lorenzo wrote:
The error message looks pretty clear. You don't have the right connection credentials for accessing your mysql database

On Wednesday, February 25, 2015 at 4:37:18 AM UTC+1, Joe T. wrote:
Looking for clarification of the bake command, or confirmation if this is a bug...

i can specify a connection for cake bake model, but it appears template also wants a connection, so i tried to specify the same connection config as i have been for models. However, template didn't use the specified connection (user would have been 'kodiak_www_admin' for the 'admin' DB config).

If my command is wrong, what should it be? Documentation looks kinda brief at http://book.cakephp.org/3.0/en/bake/usage.html unless there's somewhere else i missed?

i added the --prefix Admin for the Template bake because i get the impression i should provide the same for Templates as for Controllers?

-- WORKS
C
:\Sites\project>App\Console\cake bake model --connection admin Listings

-- NOPE
C
:\Sites\project>App\Console\cake bake template --connection admin --prefix Admin Listings

Welcome to CakePHP v3.0.0-RC2 Console
---------------------------------------------------------------
App : App
Path: C:\Sites\project\App\
---------------------------------------------------------------
Exception: SQLSTATE[HY000] [1045] Access denied for user 'kodiak_www'@'localhost' (using password: YES) in [C:\Sites\project\vendor\cakephp\cakephp\src\Database\Driver\PDODriverTrait.php, line 48]
2015-02-25 03:00:34 Error: [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'kodiak_www'@'localhost' (using password: YES)
Stack Trace:
#0 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Driver\PDODriverTrait.php(48): PDO->__construct('mysql:host=loca...', 'kodiak_www', '-------------', Array)
#1 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Driver\Mysql.php(86): Cake\Database\Driver\Mysql->_connect('mysql:host=loca...', Array)
#2 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Schema\BaseSchema.php(46): Cake\Database\Driver\Mysql->connect()
#3 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Dialect\MysqlDialectTrait.php(62): Cake\Database\Schema\BaseSchema->__construct(Object(Cake\Database\Driver\Mysql))
#4 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(52): Cake\Database\Driver\Mysql->schemaDialect()
#5 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Schema\CachedCollection.php(44): Cake\Database\Schema\Collection->__construct(Object(Cake\Database\Connection))
#6 C:\Sites\project\vendor\cakephp\cakephp\src\Database\Connection.php(319): Cake\Database\Schema\CachedCollection->__construct(Object(Cake\Database\Connection), true)
#7 C:\Sites\kodiakinvestmentsllc.com-cake3\vendor\cakephp\cakephp\src\ORM\Table.php(410): Cake\Database\Connection->schemaCollection()
#8 C:\Sites\project\vendor\cakephp\bake\src\Shell\Task\TemplateTask.php(273): Cake\ORM\Table->schema()
#9 C:\Sites\project\vendor\cakephp\bake\src\Shell\Task\TemplateTask.php(139): Bake\Shell\Task\TemplateTask->_loadController()
#10 [internal function]: Bake\Shell\Task\TemplateTask->main('Listings')
#11 C:\Sites\project\vendor\cakephp\cakephp\src\Console\Shell.php(387): call_user_func_array(Array, Array)
#12 C:\Sites\project\vendor\cakephp\cakephp\src\Console\Shell.php(382): Cake\Console\Shell->runCommand(Array, false)
#13 C:\Sites\project\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(200): Cake\Console\Shell->runCommand(Array, true)
#14 C:\Sites\project\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(171): Cake\Console\ShellDispatcher->_dispatch()
#15 C:\Sites\project\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(122): Cake\Console\ShellDispatcher->dispatch()
#16 C:\Sites\project\App\Console\cake.php(20): Cake\Console\ShellDispatcher::run(Array)
#17 {main}


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: