Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foreach() argument must be of type array|object, bool given #20214

Open
safisrls opened this issue Jun 25, 2024 · 1 comment
Open

foreach() argument must be of type array|object, bool given #20214

safisrls opened this issue Jun 25, 2024 · 1 comment

Comments

@safisrls
Copy link

Ho installato Yii2 e l'estione 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

  1. 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
      */
      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;
      }

  2. 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;
    
  3. 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}'] = '';
    }

  4. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\BaseObject.php at line 109– yii\gii\components\ActiveField::init()

  5. yii\base\BaseObject::__construct(['hintOptions' => ['tag' => 'small', 'class' => 'form-text text-muted'], 'errorOptions' => ['class' => 'invalid-feedback'], 'model' => yii\gii\generators\model\Generator, 'attribute' => 'tableName', ...])

  6. 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', ...]])

  7. 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', ...])

  8. 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', ...])

  9. 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', ...])

  10. 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('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('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('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('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()) {
  1. yii\gii\controllers\DefaultController::actionView('model')
  2. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\InlineAction.php at line 57– call_user_func_array([yii\gii\controllers\DefaultController, 'actionView'], ['model'])
  3. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Controller.php at line 178– yii\base\InlineAction::runWithParams(['r' => 'gii/default/view', 'id' => 'model'])
  4. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Module.php at line 552– yii\base\Controller::runAction('view', ['r' => 'gii/default/view', 'id' => 'model'])
  5. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\web\Application.php at line 103– yii\base\Module::runAction('gii/default/view', ['r' => 'gii/default/view', 'id' => 'model'])
  6. in C:\xampp\htdocs\sgretail\vendor\yiisoft\yii2\base\Application.php at line 384– yii\web\Application::handleRequest(yii\web\Request)
  7. in C:\xampp\htdocs\sgretail\web\index.php at line 12– yii\base\Application::run()
    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

Yii Framework/2.0.50

@samdark
Copy link
Member

samdark commented Jun 30, 2024

What do you use for firebird?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants