I’m new with PHP and Yii and I was trying to rub Model and CRUD generator from Yii demo application. In both cases I get this:
CDbException
CDbConnection.connectionString cannot be empty.
/Applications/MAMP/htdocs/YiiRoot/framework/gii/generators/crud/CrudCode.php(44)
32 ));
33 }
34
35 public function requiredTemplates()
36 {
37 return array(
38 'controller.php',
39 );
40 }
41
42 public function init()
43 {
44 if(Yii::app()->db===null)
45 throw new CHttpException(500,'An active "db" connection is required to run this generator.');
46 parent::init();
47 }
48
49 public function successMessage()
50 {
51 $link=CHtml::link('try it now', Yii::app()->createUrl($this->controller), array('target'=>'_blank'));
52 return "The controller has been generated successfully. You may $link.";
53 }
54
55 public function validateModel($attribute,$params)
56 {
THis demo came with latest stable version. I have check content of connectionString and it matches the real data, like port, database name. Database is started and accessible with phpadmin. What could be wrong?
Does it work if you comment out the db part for mysql, and uncomment the part for sqlite? Trying to work out if it’s an error with your config file, as this error should only appear when no connectionString has been specified.