Hi!
I have a table with company’s data and another table with the contact’s data. So, I decided to use this great extension to generate my CRUD, but when I try to update some company with contacts I receive this error message: “Object of class Contato could not be converted to int” and this doesnt happen when the company doesnt have contacts.
Is this a bug or some incompatibility with yiistrap extension?
This is the stack trace:
PHP notice
Object of class Contato could not be converted to int
/opt/lampp/htdocs/polyafer-app2/protected/extensions/bootstrap/helpers/TbHtml.php(987)
975 $checkAllLast = TbArray::popValue('checkAllLast', $htmlOptions);
976 if ($checkAll !== null) {
977 $checkAllLabel = $checkAll;
978 $checkAllLast = $checkAllLast !== null;
979 }
980
981 $items = array();
982 $baseID = $containerOptions['id'] = TbArray::popValue('baseID', $htmlOptions, parent::getIdByName($name));
983 $id = 0;
984 $checkAll = true;
985
986 foreach ($data as $value => $label) {
987 $checked = !is_array($select) && !strcmp($value, $select) || is_array($select) && in_array($value, $select);
988 $checkAll = $checkAll && $checked;
989 $htmlOptions['value'] = $value;
990 $htmlOptions['id'] = $baseID . '_' . $id++;
991 if ($inline) {
992 $htmlOptions['label'] = $label;
993 self::addCssClass('inline', $labelOptions);
994 $htmlOptions['labelOptions'] = $labelOptions;
995 $items[] = self::checkBox($name, $checked, $htmlOptions);
996 } else {
997 self::addCssClass('checkbox', $labelOptions);
998 $option = self::checkBox($name, $checked, $htmlOptions);
999 $items[] = self::label($option . ' ' . $label, false, $labelOptions);
– /opt/lampp/htdocs/polyafer-app2/protected/extensions/bootstrap/helpers/TbHtml.php(1719): TbHtml::checkBoxList("Empresa[contatos]", array(Contato, Contato), array(1 => "Ednei Rodrigues", 2 => "Matheus Benaia"), array("id" => "Empresa_contatos"))
1714 }
1715 $name = TbArray::popValue('name', $htmlOptions);
1716 $unCheck = TbArray::popValue('uncheckValue', $htmlOptions, '');
1717 $hiddenOptions = isset($htmlOptions['id']) ? array('id' => parent::ID_PREFIX . $htmlOptions['id']) : array('id' => false);
1718 $hidden = $unCheck !== null ? parent::hiddenField($name, $unCheck, $hiddenOptions) : '';
1719 return $hidden . self::checkBoxList($name, $selection, $data, $htmlOptions);
1720 }
1721
1722 /**
1723 * Generates an inline check box list for a model attribute.
1724 * @param CModel $model the data model.
/opt/lampp/htdocs/polyafer-app2/protected/extensions/bootstrap/widgets/TbActiveForm.php(379): [b]TbHtml[/b]::[b]activeCheckBoxList[/b](Empresa, "contatos", array(1 => "Ednei Rodrigues", 2 => "Matheus Benaia"), array())
374 * @return string the generated checkbox list.
375 * @see TbHtml::activeCheckBoxList
376 */
377 public function checkBoxList($model, $attribute, $data, $htmlOptions = array())
378 {
379 return TbHtml::activeCheckBoxList($model, $attribute, $data, $htmlOptions);
380 }
381
382 /**
383 * Renders an inline checkbox list for a model attribute.
384 * @param CModel $model the data model.
– /opt/lampp/htdocs/polyafer-app2/protected/views/empresa/_form.php(79): TbActiveForm->checkBoxList(Empresa, "contatos", array(1 => "Ednei Rodrigues", 2 => "Matheus Benaia"))
74 TbHtml::submitButton(Yii::t('app','Save'), array('color' => TbHtml::BUTTON_COLOR_PRIMARY)),
75 TbHtml::resetButton(Yii::t('app', 'Reset')),
76 )); ?>
77
78 <label><?php echo GxHtml::encode($model->getRelationLabel('contatos')); ?></label>
79 <?php echo $form->checkBoxList($model, 'contatos', GxHtml::encodeEx(GxHtml::listDataEx(Contato::model()->findAllAttributes(null, true)), false, true)); ?>
80 <label><?php echo GxHtml::encode($model->getRelationLabel('enderecos')); ?></label>
81 <?php echo $form->checkBoxList($model, 'enderecos', GxHtml::encodeEx(GxHtml::listDataEx(Endereco::model()->findAllAttributes(null, true)), false, true)); ?>
82 <label><?php echo GxHtml::encode($model->getRelationLabel('orcamentoServicos')); ?></label>
83 <?php echo $form->checkBoxList($model, 'orcamentoServicos', GxHtml::encodeEx(GxHtml::listDataEx(OrcamentoServico::model()->findAllAttributes(null, true)), false, true)); ?>
84 <label><?php echo GxHtml::encode($model->getRelationLabel('orcamentoVendas')); ?></label>