codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.38k stars 1.9k forks source link

Bug: spark make:cell doesn't create view file properly #7469

Closed rcorsari closed 1 year ago

rcorsari commented 1 year ago

deleted because of a mistake, sorry, I recap in the following reply

rcorsari commented 1 year ago

Environment WIndows PHP 8.2 Codeigniter is 4.3.4 installed as appStarter with composer MariaDB is latest version Served with php spark serve

This is the terminal (follows after the terminal output)

C:\WWW\htmx>php spark make:cell PippoCell

CodeIgniter v4.3.4 Command Line Tool - Server Time: 2023-05-01 16:56:42 UTC+00:00

File created: APPPATH\Cells\PippoCell.php

File created: APPPATH\Cells\pippo_cell.php

but these are the contents of the two files

PippoCell.php

<?php

namespace App\Cells;

use CodeIgniter\View\Cells\Cell;

class PippoCell extends Cell
{
    //
}

and

pippo_cell.php

<?php

namespace App\Cells;

use CodeIgniter\View\Cells\Cell;

class pippo_cell extends Cell
{
    //
}
kenjis commented 1 year ago

Please use bug report template. And what's your issue? The behavior you reported is expected.

rcorsari commented 1 year ago

So now both the cell and the cellview are a class? Thank you for confirming I ask because one subversion ago, 4.3.3 the cells bug was just the naming of the files but the view content was HTML and exactly a DIV opening and closing tag thank you

paulbalandan commented 1 year ago

I think this is a bug caused by #7458. The addition of make:cell in the Config/Generators array effectively bypasses $this-template reassignment in https://github.com/codeigniter4/CodeIgniter4/blob/729634c3561e1d8d0742f0e691c810ced8ce6a67/system/Commands/Generators/CellGenerator.php#L96, causing both the class name and view name using the same template.

paulbalandan commented 1 year ago

Confirmed to be found in v4.3.4, not on v4.3.3

kenjis commented 1 year ago

Oh, I see. I didn't see the contents of the files.