schmunk42 / yii2-giiant

Yii 2 Framework Code Generator Gii on Steroids
271 stars 120 forks source link

updated gii JSON form config path creates two bugs #277

Closed OndrejVasicek closed 3 years ago

OndrejVasicek commented 3 years ago

Hi Schmunk42. This commit https://github.com/schmunk42/yii2-giiant/commit/52a14ac3027b6898debf565a378fcb378ed3ac31 breaks two things in situation you want to load already saved form.

1) The “JSON_PRETT_PRINT” makes the JS code corrupted and it breaks any JS functionality, like filling the fields. image image image

2) The loadSavedForms() in SaveForm.php can’t find the new path because the folder "gii" is hardcoded there. image If I change it to: image it works but of course the bug 1) still persists.

schmunk42 commented 3 years ago

Folder was moved recently, could your create a PR?

OndrejVasicek commented 3 years ago

I could do a PR for that small change, but it's very bad solution. I don't think the path should be hardcoded at various places. It should be set in some config or constant. You have some variables $giiInfoPath in crud\Generator.php and model\Generator.php, but I don't know if this is it and how it is accessible from the static method loadSavedForms(). I really think it needs some proper design, which I'm not capable of, cause I don't know the plugin. Maybe with some help I could help.

Also it doesn't solve the first problem with the JS. When you started using the new JSON formatting, there was probably a reason for that. I can't just switch that back, can I?

uldisn commented 3 years ago

Why can't I use the current module directory gii?

schmunk42 commented 3 years ago

I just moved the info files to a folder named .gii (from gii) since it was cluttering the "standard" source code directories. I.e. we ignore .gii because we do not use the web UI at all.

uldisn commented 3 years ago

Created PR: https://github.com/schmunk42/yii2-giiant/pull/278

schmunk42 commented 3 years ago

merged and available in 0.13.0-beta2