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

Bug: error when run: php spark shield:model UserModel #39

Open
itmanvn opened this issue May 23, 2023 · 1 comment
Open

Bug: error when run: php spark shield:model UserModel #39

itmanvn opened this issue May 23, 2023 · 1 comment

Comments

@itmanvn
Copy link

itmanvn commented May 23, 2023

PHP Version

8.2.6

CodeIgniter4 Version

4.3.4

Shield Version

dev-develop

Shield OAuth Version?

dev-main

Which operating systems have you tested for this bug?

Windows

Which server did you use?

cli

Database

MySQL 8.0.33

Did you add customize OAuth?

No

What happened?

D:\www\mobileproxy>php spark shield:model UserModel

CodeIgniter v4.3.5 Command Line Tool - Server Time: 2023-05-23 01:15:15 UTC+00:00


[ErrorException]

foreach() argument must be of type array|object, string given

at VENDORPATH\datamweb\shield-oauth\src\Libraries\Basic\ShieldOAuth.php:86

Backtrace:
  1    VENDORPATH\datamweb\shield-oauth\src\Libraries\Basic\ShieldOAuth.php:86
       CodeIgniter\Debug\Exceptions()->errorHandler(2, 'foreach() argument must be of type array|object, string given', 'D:\\www\\mobileproxy\\vendor\\datamweb\\shield-oauth\\src\\Libraries\\Basic\\ShieldOAuth.php', 86)

  2    VENDORPATH\datamweb\shield-oauth\src\Libraries\Basic\ShieldOAuth.php:111
       Datamweb\ShieldOAuth\Libraries\Basic\ShieldOAuth()->otherOAuth()

  3    VENDORPATH\datamweb\shield-oauth\src\Views\Decorators\ShieldOAuth.php:21
       Datamweb\ShieldOAuth\Libraries\Basic\ShieldOAuth()->makeOAuthButton('login')

  4    SYSTEMPATH\View\ViewDecoratorTrait.php:31
       Datamweb\ShieldOAuth\Views\Decorators\ShieldOAuth::decorate('<@php

declare(strict_types=1);

namespace {namespace};

use CodeIgniter\\Shield\\Models\\UserModel as ShieldUserModel;

class {class} extends ShieldUserModel
{
    protected function initialize(): void
    {
        parent::initialize();

        $this->allowedFields = [
            ...$this->allowedFields,

            // \'first_name\',
        ];
    }
}')

  5    SYSTEMPATH\View\View.php:234
       CodeIgniter\View\View()->decorateOutput('<@php

declare(strict_types=1);

namespace {namespace};

use CodeIgniter\\Shield\\Models\\UserModel as ShieldUserModel;

class {class} extends ShieldUserModel
{
    protected function initialize(): void
    {
        parent::initialize();

        $this->allowedFields = [
            ...$this->allowedFields,

            // \'first_name\',
        ];
    }
}')

  6    SYSTEMPATH\Common.php:1184
       CodeIgniter\View\View()->render('CodeIgniter\\Commands\\Generators\\Views\\usermodel.tpl.php', [...], true)

  7    SYSTEMPATH\CLI\GeneratorTrait.php:274
       view('CodeIgniter\\Commands\\Generators\\Views\\usermodel.tpl.php', [], [...])

  8    SYSTEMPATH\CLI\GeneratorTrait.php:292
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->renderTemplate([])

  9    SYSTEMPATH\CLI\GeneratorTrait.php:204
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->parseTemplate('App\\Models\\UserModel')

 10    SYSTEMPATH\CLI\GeneratorTrait.php:302
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->prepare('App\\Models\\UserModel')

 11    SYSTEMPATH\CLI\GeneratorTrait.php:115
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->buildContent('App\\Models\\UserModel')

 12    SYSTEMPATH\CLI\GeneratorTrait.php:94
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->generateClass([...])

 13    VENDORPATH\codeigniter4\shield\src\Commands\Generators\UserModelGenerator.php:77
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->execute([...])

 14    SYSTEMPATH\CLI\Commands.php:65
       CodeIgniter\Shield\Commands\Generators\UserModelGenerator()->run([...])

 15    SYSTEMPATH\CLI\Console.php:37
       CodeIgniter\CLI\Commands()->run('shield:model', [...])

 16    ROOTPATH\spark:97
       CodeIgniter\CLI\Console()->run()

Steps to Reproduce

Open CMD

Expected Output

php spark shield:model UserModel

Anything else?

No response

@itmanvn itmanvn added the bug Something isn't working label May 23, 2023
@datamweb
Copy link
Owner

Hello @itmanvn , Thanks for your report.

You recorded CodeIgniter4 Version : 4.3.4 in the report, but it shows version CodeIgniter v4.3.5 Command Line Tool in the command line, why?

I was unable to reproduce your problem, what change have you made? Provide more details for reproduction.

Screenshot 2023-05-24 080424

Don't forget to use the latest version:

composer require datamweb/shield-oauth:dev-develop

@datamweb datamweb removed the bug Something isn't working label May 24, 2023
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