first time with gii - crud generator throwing a cexception

hello yii community!

So, this is my first time with yii. I have gotten the yiic to function properly and to generate my demo app.

I am trying to test the different functionalities of gii and when clicking the CRUD generator or the model generator i get:

CException

Property "CDbConnection.0" is not defined.

with other infos:

{

211 unset($args[0]);

212 $class=new ReflectionClass($type);

213 // Note: ReflectionClass::newInstanceArgs() is available for PHP 5.1.3+

214 // $object=$class->newInstanceArgs($args);

215 $object=call_user_func_array(array($class,‘newInstance’),$args);

216 }

217 }

218 else

219 $object=new $type;

220

221 foreach($config as $key=>$value)

222 $object->$key=$value;

223

224 return $object;

225 }

226

227 /**

228 * Imports a class or a directory.

229 *

230 * Importing a class is like including the corresponding class file.

231 * The main difference is that importing a class is much lighter because it only

232 * includes the class file when the class is referenced the first time.

233 *

234 * Importing a directory is equivalent to adding a directory into the PHP include path.

line 222 being hightlighted

I have tried many solutions and searched for a while and therefore am sharing this with the community

when i go to the requirements page i get this:

2430

Capture d’écran 2012-01-10 à 18.16.25.png

maybe this has something to do with my database

here is my main.php where are my db infos:

// application components

‘components’=>array(

‘user’=>array(

// enable cookie-based authentication

‘allowAutoLogin’=>true,

),

// uncomment the following to enable URLs in path-format

/*

‘urlManager’=>array(

‘urlFormat’=>‘path’,

‘rules’=>array(

‘<controller:\w+>/<id:\d+>’=>’<controller>/view’,

‘<controller:\w+>/<action:\w+>/<id:\d+>’=>’<controller>/<action>’,

‘<controller:\w+>/<action:\w+>’=>’<controller>/<action>’,

),

),

*/

/*‘db’=>array(

‘connectionString’ => ‘sqlite:’.dirname(FILE).’/../data/testdrive.db’,

),*/

‘db’=>array(

‘connectionString’ => ‘mysql:host=mysql5.pulp-communications.ch;dbname=here i write the name’,

‘emulatePrepare’ => true,

‘username’ => ‘here i write the name’,

‘password’ => ‘*******’,

‘charset’ => ‘utf8’,

),

after wondering if it was the fact that i was working localy

i uploaded everything online, created a db with phpmyadmin, and knows that it is functional and accessible

i saw someone with a similar question but no real answer!! hmm hope this is not a tought problem

thanks again and don’t hesitate to ask more info!!

2431

Capture d’écran 2012-01-10 à 18.41.13.png

Welcome to the forum.

It looks like you have some garbage character before the closing bracket of the db array.

/Tommy

I think there is problem with ur config file.Check that database connection string in config file.

@tri

thank you very much! indeed there were some garbage characters and everything is working fine now :D

I’m quite happy and I’ve started to implement my models etc…

how would you define these garbage characters? all i did was backspace them and rewrote them and it ended up working - was it because my characters were copied from another doc?

thanks again!

@Mangesh Lad

I’m not sure what you mean. I thought that the db array was exactly that!