- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to get Gii working on Limesurvey installation
- allanzmn
- Topic Author
- Offline
- New Member
Less
More
6 years 11 months ago #154920
by allanzmn
How to get Gii working on Limesurvey installation was created by allanzmn
Hi everyone.
I´m new to Yii and Limesurvey plus the last version I used of PHP was 4.6. I´m sorry if this is a stupid question. I´ll make sure to search as much as I can before posting any doubts.
I´m recently back to PHP and I was assigned to develop a plugin to integrate limesurvey with the companys CRM software. I would like to use Gii to generate some code to me as It would save me time and would help me with my learning curve. I checked Gii docs ( www.yiiframework.com/doc-2.0/guide-start-gii.html ) but I couldn´t make it work on the Limesurvey installation. Could anyone assist?
Thanks.
I´m new to Yii and Limesurvey plus the last version I used of PHP was 4.6. I´m sorry if this is a stupid question. I´ll make sure to search as much as I can before posting any doubts.
I´m recently back to PHP and I was assigned to develop a plugin to integrate limesurvey with the companys CRM software. I would like to use Gii to generate some code to me as It would save me time and would help me with my learning curve. I checked Gii docs ( www.yiiframework.com/doc-2.0/guide-start-gii.html ) but I couldn´t make it work on the Limesurvey installation. Could anyone assist?
Thanks.
The topic has been locked.
- allanzmn
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
6 years 11 months ago #154922
by allanzmn
Replied by allanzmn on topic How to get Gii working on Limesurvey installation
Found this on config/internal.php:
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
// 'password'=>'toto',
// 'ipFilters'=>array(...a list of IPs...),
// 'newFileMode'=>0666,
// 'newDirMode'=>0777,
),
),
I suppose this is where it sould be activated. I tried to uncomment but when I try accessing http://mylime/index.php?r=gii it takes me to the front page with the public surveys list.
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
// 'password'=>'toto',
// 'ipFilters'=>array(...a list of IPs...),
// 'newFileMode'=>0666,
// 'newDirMode'=>0777,
),
),
I suppose this is where it sould be activated. I tried to uncomment but when I try accessing http://mylime/index.php?r=gii it takes me to the front page with the public surveys list.
The topic has been locked.
- allanzmn
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
6 years 11 months ago - 6 years 11 months ago #154950
by allanzmn
Replied by allanzmn on topic How to get Gii working on Limesurvey installation
Got it to work accessing by:
http://mylime/gii
No i´m trying to point Gii to another MySql DB that I want to build the ActiveRecords. I created another db component in the config.php file as bellow:
But when fill Gii model form with the proper information and try to preview I get:
Error 500
Alias "yii.db" is invalid. Make sure it points to an existing directory or file.
http://mylime/gii
No i´m trying to point Gii to another MySql DB that I want to build the ActiveRecords. I created another db component in the config.php file as bellow:
Code:
'db_exata' => array( class' => 'yii\db\Connection', 'connectionString' => 'mysql:host=localhost;port=3306;dbname=test;', 'username' => 'user', 'password' => 'pass', ),
But when fill Gii model form with the proper information and try to preview I get:
Error 500
Alias "yii.db" is invalid. Make sure it points to an existing directory or file.
Sorry... Just pointed to CDbConnection class and it worked fine.
Last edit: 6 years 11 months ago by allanzmn. Reason: Solved
The topic has been locked.
- LouisGac
- Visitor
6 years 11 months ago - 6 years 11 months ago #154956
by LouisGac
Replied by LouisGac on topic How to get Gii working on Limesurvey installation
Extending Gii to make possible to use it to generate base code for plugins/questions templates etc is one of my long term goal (I still have to convince the rest of the team, and we already have a lot of things to do right now).
I used it to generate the Home Page settings, so I'd strongly suggest you have a look into the commits related to that page. You'll see that LS controllers/actions/views system is not 100% in the Yii style, and you must modify few files after you used Gii. See this commit, and adminController + mother class of homepagesettings (Survey_Common_Action) :
github.com/LimeSurvey/LimeSurvey/commit/...cbaebaf24298d2c45fa9
Concerning the external DB:
www.yiiframework.com/doc/guide/1.1/en/database.dao
In Yii1, name space feature is not really integrated. So you must use the class "CDbConnection", and not the name space 'yii\db\Connection'
Your code is valid for Yii2, which is using modern PHP syntax. But LimeSurvey uses Yii1, not Yii2.
I used it to generate the Home Page settings, so I'd strongly suggest you have a look into the commits related to that page. You'll see that LS controllers/actions/views system is not 100% in the Yii style, and you must modify few files after you used Gii. See this commit, and adminController + mother class of homepagesettings (Survey_Common_Action) :
github.com/LimeSurvey/LimeSurvey/commit/...cbaebaf24298d2c45fa9
Concerning the external DB:
www.yiiframework.com/doc/guide/1.1/en/database.dao
In Yii1, name space feature is not really integrated. So you must use the class "CDbConnection", and not the name space 'yii\db\Connection'
Code:
'dbExata'=>array( 'class'=>'CDbConnection', 'connectionString'=>'mysql:host=localhost;dbname=testdb', 'username'=>'root', 'password'=>'password', 'emulatePrepare'=>true, // needed by some MySQL installations ),
Your code is valid for Yii2, which is using modern PHP syntax. But LimeSurvey uses Yii1, not Yii2.
Last edit: 6 years 11 months ago by LouisGac.
The topic has been locked.