Skip to content

Bug: Generator Command cannot locate the view template. #7405

@sammyskills

Description

@sammyskills

PHP Version

7.4

CodeIgniter4 Version

4.3.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

No response

What happened?

I created a generator command like so:

php spark make:command TestCommandGenerator --type generator --command make:me-test

And updated the file like so:

public function run(array $params)
{
    $this->component = 'Library';
    $this->directory = 'Libraries';
    $this->template = 'me.tpl.php';

    $this->execute($params);
}

I have the generator template in the directory: app/Commands/Generators/Views/me.tpl.php. But when I try to use the command php spark make:me-test, I get the error message:

Invalid file: "CodeIgniter\Commands\Generators\Views\me.tpl.php"

Steps to Reproduce

  1. Create a new command: php spark make:command TestCommandGenerator --type generator --command make:me-test.
  2. Create the generator template and place it within the app/Commands/Generators/Views folder.
  3. Update the run() method of the TestCommandGenerator.php to contain the name of the view template you created above: $this->template = ''; // name of file here
  4. Run the command php spark make:me-test.

Expected Output

I expect that the view template file would be located within the app namespace instead of CodeIgniter.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix themdocumentationPull requests for documentation only

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions