Ho installato Yii2 e l’estensione Edgar Messias firebird yii2, qundo cerco di esegiure gii model Generator mi da questo errore:
PHP Warning – yii\base\ErrorException
foreach() argument must be of type array|object, bool given
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2-gii\src\components\ActiveField.phpat line 77
68697071727374757677787980818283848586 * @param array $data auto complete data (array of callables or scalars)
-
@return $this the field object itself
2./
public function autoComplete($data)
{
$inputID = $this->getInputId();
ArrayHelper::setValue($this->inputOptions, ‘list’, “$inputID-list”);$html = Html::beginTag(‘datalist’, [‘id’ => “$inputID-list”]) . “\n”;
foreach ($data as $item) {
$html .= Html::tag(‘option’, $item) . “\n”;
}
$html .= Html::endTag(‘datalist’);$this->parts[‘{list}’] = $html;return $this;
}
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2-gii\src\components\ActiveField.php at line 77– yii\base\ErrorHandler::handleError(2, ‘foreach() argument must be of ty…’, ‘C:\xampp\htdocs\sgretail\vendor…’, 77)
71727374757677787980818283 public function autoComplete($data)
{
$inputID = $this->getInputId();
ArrayHelper::setValue($this->inputOptions, ‘list’, “$inputID-list”);
$html = Html::beginTag('datalist', ['id' => "$inputID-list"]) . "\n";
foreach ($data as $item) {
$html .= Html::tag('option', $item) . "\n";
}
$html .= Html::endTag('datalist');
$this->parts['{list}'] = $html;
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2-gii\src\components\ActiveField.php at line 46– yii\gii\components\ActiveField::autoComplete(false)
40414243444546474849505152 if (isset($hints[$this->attribute])) {
$this->hint($hints[$this->attribute]);
}
$autoCompleteData = $this->model->autoCompleteData();
if (isset($autoCompleteData[$this->attribute])) {
if (is_callable($autoCompleteData[$this->attribute])) {
$this->autoComplete(call_user_func($autoCompleteData[$this->attribute]));
} else {
$this->autoComplete($autoCompleteData[$this->attribute]);
}
} else {
$this->parts[‘{list}’] = ‘’;
} - in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\BaseObject.php at line 109– yii\gii\components\ActiveField::init()
- yii\base\BaseObject::__construct([‘hintOptions’ => [‘tag’ => ‘small’, ‘class’ => ‘form-text text-muted’], ‘errorOptions’ => [‘class’ => ‘invalid-feedback’], ‘model’ => yii\gii\generators\model\Generator, ‘attribute’ => ‘tableName’, …])
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\di\Container.php at line 419– ReflectionClass::newInstanceArgs([[‘hintOptions’ => [‘tag’ => ‘small’, ‘class’ => ‘form-text text-muted’], ‘errorOptions’ => [‘class’ => ‘invalid-feedback’], ‘model’ => yii\gii\generators\model\Generator, ‘attribute’ => ‘tableName’, …]])
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\di\Container.php at line 170– yii\di\Container::build(‘yii\gii\components\ActiveField’, [], [‘hintOptions’ => [‘tag’ => ‘small’, ‘class’ => ‘form-text text-muted’], ‘errorOptions’ => [‘class’ => ‘invalid-feedback’], ‘model’ => yii\gii\generators\model\Generator, ‘attribute’ => ‘tableName’, …])
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\BaseYii.php at line 365– yii\di\Container::get(‘yii\gii\components\ActiveField’, [], [‘hintOptions’ => [‘tag’ => ‘small’, ‘class’ => ‘form-text text-muted’], ‘errorOptions’ => [‘class’ => ‘invalid-feedback’], ‘model’ => yii\gii\generators\model\Generator, ‘attribute’ => ‘tableName’, …])
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\widgets\ActiveForm.php at line 331– yii\BaseYii::createObject([‘hintOptions’ => [‘tag’ => ‘small’, ‘class’ => ‘form-text text-muted’], ‘errorOptions’ => [‘class’ => ‘invalid-feedback’], ‘model’ => yii\gii\generators\model\Generator, ‘attribute’ => ‘tableName’, …])
- in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2-gii\src\generators\model\form.php at line 13– yii\widgets\ActiveForm::field(yii\gii\generators\model\Generator, ‘tableName’)
78910111213141516171819/** @var yii\widgets\ActiveForm $form /
/* @var yii\gii\generators\model\Generator $generator */
echo $form->field($generator, ‘db’);
echo $form->field($generator, ‘useTablePrefix’)->checkbox();
echo $form->field($generator, ‘useSchemaName’)->checkbox();
echo $form->field($generator, ‘tableName’)->textInput([
‘autocomplete’ => ‘off’,
‘data’ => [
‘table-prefix’ => $generator->getTablePrefix(),
‘action’ => Url::to([‘default/action’, ‘id’ => ‘model’, ‘name’ => ‘GenerateClassName’])
]
]);
11. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\View.php at line 348– require(‘C:\xampp\htdocs\sgretail\vendor…’)
12. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\View.php at line 258– yii\base\View::renderPhpFile(‘C:\xampp\htdocs\sgretail\vendor…’, [‘generator’ => yii\gii\generators\model\Generator, ‘form’ => yii\widgets\ActiveForm])
13. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2-gii\src\views\default\view.php at line 41– yii\base\View::renderFile(‘C:\xampp\htdocs\sgretail\vendor…’, [‘generator’ => yii\gii\generators\model\Generator, ‘form’ => yii\widgets\ActiveForm])
35363738394041424344454647 ‘hintOptions’ => [‘tag’ => ‘small’, ‘class’ => ‘form-text text-muted’],
‘errorOptions’ => [‘class’ => ‘invalid-feedback’]
],
]); ?>
renderFile($generator->formView(), [ ‘generator’ => $generator, ‘form’ => $form, ]) ?>
<?= $form->field($generator, 'template') ->sticky() ->hint('Please select which set of the templates should be used to generated the code.') 14. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\View.php at line 348– require('C:\xampp\htdocs\sgretail\vendor...') 15. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\View.php at line 258– [yii\base\View::renderPhpFile](https://www.yiiframework.com/doc-2.0/yii-base-view.html#renderPhpFile()-detail)('C:\xampp\htdocs\sgretail\vendor...', ['generator' => yii\gii\generators\model\Generator, 'id' => 'model']) 16. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\View.php at line 157– [yii\base\View::renderFile](https://www.yiiframework.com/doc-2.0/yii-base-view.html#renderFile()-detail)('C:\xampp\htdocs\sgretail\vendor...', ['generator' => yii\gii\generators\model\Generator, 'id' => 'model'], yii\gii\controllers\DefaultController) 17. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Controller.php at line 407– [yii\base\View::render](https://www.yiiframework.com/doc-2.0/yii-base-view.html#render()-detail)('view', ['generator' => yii\gii\generators\model\Generator, 'id' => 'model'], yii\gii\controllers\DefaultController) 18. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2-gii\src\controllers\DefaultController.php at line 72– [yii\base\Controller::render](https://www.yiiframework.com/doc-2.0/yii-base-controller.html#render()-detail)('view', ['generator' => yii\gii\generators\model\Generator, 'id' => 'model']) 66676869707172737475767778 $params['files'] = $files; $params['answers'] = $answers; } } } ``` return $this->render('view', $params); } public function actionPreview($id, $file) { $generator = $this->loadGenerator($id); if ($generator->validate()) { ``` 19. [yii\gii\controllers\DefaultController::actionView](https://www.yiiframework.com/doc-2.0/yii-gii-controllers-defaultcontroller.html#actionView()-detail)('model') 20. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\InlineAction.php at line 57– call_user_func_array([yii\gii\controllers\DefaultController, 'actionView'], ['model']) 21. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Controller.php at line 178– [yii\base\InlineAction::runWithParams](https://www.yiiframework.com/doc-2.0/yii-base-inlineaction.html#runWithParams()-detail)(['r' => 'gii/default/view', 'id' => 'model']) 22. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Module.php at line 552– [yii\base\Controller::runAction](https://www.yiiframework.com/doc-2.0/yii-base-controller.html#runAction()-detail)('view', ['r' => 'gii/default/view', 'id' => 'model']) 23. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\web\Application.php at line 103– [yii\base\Module::runAction](https://www.yiiframework.com/doc-2.0/yii-base-module.html#runAction()-detail)('gii/default/view', ['r' => 'gii/default/view', 'id' => 'model']) 24. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Application.php at line 384– [yii\web\Application::handleRequest](https://www.yiiframework.com/doc-2.0/yii-web-application.html#handleRequest()-detail)(yii\web\Request) 25. in C:\xampp\htdocs\sgretail\web\index.php at line 12– [yii\base\Application::run](https://www.yiiframework.com/doc-2.0/yii-base-application.html#run()-detail)() 6789101112 require **DIR** . '/../vendor/autoload.php'; require **DIR** . '/../vendor/yiisoft/yii2/Yii.php'; $config = require **DIR** . '/../config/web.php'; (new yii\web\Application($config))->run(); $_GET = [ 'r' => 'gii/default/view', 'id' => 'model', ]; $_COOKIE = [ '_csrf' => '4e004e15ec431ad0e2a3bf6a7a46933e8ca6c1b52125076dfd3e724deeddb999a:2:{i:0;s:5:"_csrf";i:1;s:32:"OBqcMlhnfTDwAJCnWQo-fS3ep9cehoH1";}', ]; |Q|A| | --- | --- | |Yii version|2.0.50| |PHP version|8.2.12| |Operating system|Win 10| |[Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12](https://httpd.apache.org/)|| [Yii Framework](https://yiiframework.com/)/[2.0.50](https://github.com/yiisoft/yii2/)