Yii Framework Forum: Console command access model? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Console command access model? Rate Topic: ***** 1 Votes

#1 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 24 March 2010 - 06:49 AM

I am trying to create a console command... but I get this error:

exception 'CException' with message 'Property "CConsoleApplication.db" is read only.' in /var/www/flipbook/framework/base/CComponent.php:170
Stack trace:
#0 /var/www/flipbook/framework/base/CModule.php(435): CComponent->__set('db', Array)
#1 /var/www/flipbook/framework/base/CApplication.php(117): CModule->configure(Array)
#2 /var/www/flipbook/framework/YiiBase.php(112): CApplication->__construct('/var/www/flipbo...')
#3 /var/www/flipbook/framework/YiiBase.php(99): YiiBase::createApplication('CConsoleApplica...', '/var/www/flipbo...')
#4 /var/www/flipbook/protected/console.php(10): YiiBase::createConsoleApplication('/var/www/flipbo...')


My config for console is this:

<?php
// This is the configuration for yiic console application.
// Any writable CConsoleApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'Ebook Console Application',
    // autoloading model and component classes
    'import'=>array(
        'application.models.*'
    ),

    'db'=>array(
        'connectionString' => 'mysql:host=localhost;dbname=ebooks',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '123qwe',
        'charset' => 'utf8',
    ),
);


Does anybody know what is wrong with this :unsure:
0

#2 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 24 March 2010 - 07:02 AM

You are missing the components array.

'components' => array(
   'db' => array(
      ...
   ),
),

0

#3 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 25 March 2010 - 04:03 AM

:blink: arggh thx..

Btw what is the reason to have different config files for console and main and test?

Only for performance reasons?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users