Hi,
I recently installed Giix, i’ve never used it before, I have some small sample data in a few tables. I was just clicking through related information, when I went to create another record in a table through Yii. I got the following error that I wondered if anyone could help me with. I have not touched any of the code myself it is all purely generated from Giix and i’ve even regenerated what I thought the problem model/controller was and it still fails.
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option FROM `display_option` `t`' at line 1. The SQL statement executed was: SELECT id, option FROM `display_option` `t`
C:\xampp\htdocs\Giix\protected\extensions\giix-components\GxActiveRecord.php(248): CActiveRecord->findAll(CDbCriteria)
if (!is_array($attributes))
244 $attributes = array($attributes);
245 $attributes = array_merge($pks, $attributes);
246 }
247 $criteria->select = $attributes;
248 return parent::findAll($criteria); // error line
249 }
250
251 /**
252 * Extracts and returns only the primary keys values from each model.
253 * @param GxActiveRecord|array $model A model or an array of models.**/
// And also
C:\xampp\htdocs\Giix\protected\views\Item\_form.php(68): GxActiveRecord->findAllAttributes(null, true)
<?php echo $form->dropDownList($model, 'display_options', GxHtml::listDataEx(DisplayOption::model()->findAllAttributes(null, true))); ?> // error line
Do you need anything more of the stack?
This occurs when I’m looking at my Item/create or Item/update model/action. I’m guessing (and it is only a guess) it must be some kind of error within my DB structure taht causes Yii to get unhappy or some conflict within Giix: I wasn’t sure where to post this, if it needs to be moved to extensions then please do so and sorry. I’ll post the two DB structures
I have created a new app and used standard Gii and all the create/admin/update functions are available to me within the Model that was throwing the error using Giix.
Item Table
### Rest of command
`display_options` int(3) unsigned NOT NULL,
### More commands
KEY `fk_display_option` (`display_options`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
display_option table
`id` int(3) unsigned NOT NULL AUTO_INCREMENT,
`option` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
If somebody could help me out that would be great
I’m at a bit of a loss as this is just from the Gixx generated code.
Thanks in advance
Jonny