Closed sammyskills closed 1 year ago
This is an error in documentation. The make:cell_view
is internal to make:cell
command in order to identify the view file. It is not an actual command.
Just wondering...
Why does it have to be included in the app/Config/Generators.php file, since running php spark list
, lists the following as the Generator commands ?
Generators
make:cell Generates a new Cell file and its view.
make:command Generates a new spark command.
make:config Generates a new config file.
make:controller Generates a new controller file.
make:entity Generates a new entity file.
make:filter Generates a new filter file.
make:migration Generates a new migration file.
make:model Generates a new model file.
make:scaffold Generates a complete set of scaffold files.
make:seeder Generates a new seeder file.
make:validation Generates a new validation file.
migrate:create [DEPRECATED] Creates a new migration file. Please use "make:migration" instead.
session:migration [DEPRECATED] Generates the migration file for database sessions, Please use
"make:migration --session" instead.
Because of these lines: https://github.com/codeigniter4/CodeIgniter4/blob/da8ecfa918de29627070d8063638e4a8c98f9d76/system/CLI/GeneratorTrait.php#L267-L276
The entry in Config\Generators
is needed to render the template file.
Thinking it through, I think the class and view generations should be separate commands. The class generator make:cell
will call the view generator make:cell_view
. WDYT, @lonnieezell @kenjis ?
Oh, I see.
I'll wait for the response from other team members.
Thank you.
There is no such command make:cell_view
.
I also don't see make:cell_view
in the user guide.
What's the issue?
@paulbalandan What if I want to generate multiple files with one command? I think the restriction of 1 command 1 file is too strict.
There is no such command
make:cell_view
. I also don't seemake:cell_view
in the user guide. What's the issue?
The command is listed alongside other functional commands in the app/Config/Generators.php file without any explanation about it's usefulness or usage.
Seeing that it was added to the list of generator commands, a developer might assume that it is a new command that was introduced in version 4.3.5, only to be surprised to see that it doesn't actually "work".
Okay, I got you. The following comment is not correct in v4.3.5. https://github.com/codeigniter4/CodeIgniter4/blob/a724f92eac0f683f1de7bb44038699c0128b7f5a/app/Config/Generators.php#L14-L15
I think it should be something like this (but this is an enhancement):
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php'
],
// ...
];
By the way, do you need the command make:view_cell
that generates the view file only?
By the way, do you need the command
make:view_cell
that generates the view file only?
TBH, that was what I expected when I saw the command. However, I've not had any real-life use case, so I can't say if it is needed IMO.
In my opinion, if we want to generate only view files, we should add an option to the make:cell
command to generate only a view file.
🤔
Since the view files are more or less an empty php file, is it really necessary to create a separate command for that?
But then, your initial question still needs to be given some thoughts:
What if I want to generate multiple files with one command?
I think the only way to do this is to extend it so that multiple view files can be specified in one command.
I sent a PR #8119
Closed by #8119
PHP Version
7.4
CodeIgniter4 Version
4.3.5
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?
The file app/Config/Generators.php now contains a new line:
When I ran the command:
it returned the error:
Command "make:cell_view" not found
.Steps to Reproduce
php spark make:cell_view
Expected Output
I don't know why it was added, as no explanation is available in the docs.
Anything else?
No response