Yii Framework Forum: gii view code generation - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

gii view code generation Should improve gii view code generation

#1 User is offline   masum 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 21-February 10
  • Location:Dhaka, Bangladesh

  Posted 01 May 2012 - 01:26 AM

Dear yii framework developers,

I think after generating code from gii still there has some repetitive work for datetime, bool, enum,text, one-to-many, many-to-many relational column. But if gii generate code for those type of table column then it will be more useful for developers. For datetime a calender control can attached with text field, for boolean type column a dropdown list can be added with two text true/false, for enum type a dropdown list can be added with 1,2,3 value,For tex type column a textaria or an opensource text editor like ckeditor or tyniMce code can be generated. For one to many a dropdownlist populated with relative model data can be generated. for many-to-many check list group box can be generated. also from generation time there should an option for generate those fields or flat textbox.


Thanks
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,346
  • Joined: 12-October 09
  • Location:Croatia

Posted 01 May 2012 - 05:04 AM

Check the giix extension - http://www.yiiframew.../extension/giix
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 07 May 2012 - 10:25 AM

How about a webpage like Gii to access and modify the config.php file ?
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#4 User is offline   masum 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 21-February 10
  • Location:Dhaka, Bangladesh

Posted 07 May 2012 - 11:05 PM

Thanks mdomba for your reply. But actually we want it as a part of Yii v2.0 framework not as an external extension. Also at that extension it is mentioned that is not a fully tested extension and also they have suggested only use the extension for testing purpose not for development. But we aspect a development ready Gii in replace of current version of Gii


Again thanks for your replay.



View Postmdomba, on 01 May 2012 - 05:04 AM, said:

Check the giix extension - http://www.yiiframew.../extension/giix

0

#5 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 08 May 2012 - 02:03 AM

Idea of adding type-based generation to Gii was there for a long type. It sounds very cool at first but there are problems.

1. We don't know what type of input we should generate. For example, it's not clear if we should generate checkboxes, radios or just a textfield for enum. What's bad is that it will be very annoying if we'll generate wrong types all the time and developer will have to change more complex code.
2. Gii have custom templates support so one can create his own templates with all necessary checks.
3. Adding CKEditor or TinyMce is definitely a bad idea. It's up to developer to decide which one to use and if it should be used at all.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#6 User is offline   Psih 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 114
  • Joined: 30-June 10

Posted 08 May 2012 - 02:41 AM

View Postsamdark, on 08 May 2012 - 02:03 AM, said:

Idea of adding type-based generation to Gii was there for a long type. It sounds very cool at first but there are problems.

1. We don't know what type of input we should generate. For example, it's not clear if we should generate checkboxes, radios or just a textfield for enum. What's bad is that it will be very annoying if we'll generate wrong types all the time and developer will have to change more complex code.
2. Gii have custom templates support so one can create his own templates with all necessary checks.
3. Adding CKEditor or TinyMce is definitely a bad idea. It's up to developer to decide which one to use and if it should be used at all.

I have plans to make my own templates for my projects and I came up with the idea to add the ability to select what type of inputs and filters to generate for the fields at the preview phase. Why? Because that really depends on the situation: at one time I have a small related table and I can render a select box for filter and _form.php. At the other situation I can have a big table (say Users) - so I would generate an text input for filters and hand-craft some sort of picker for the _form.php. And for ENUM fields I, for example, always use the select box - it's more compact that radio buttons and feels natural.
0

#7 User is offline   masum 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 21-February 10
  • Location:Dhaka, Bangladesh

Posted 08 May 2012 - 06:04 AM

Dear samdark,

At the end of the post I have mentioned "also from generation time there should an option for generate those fields or flat textbox." . If anyone do not need that they will not generate with those controls. Advanced option may initially collapsed. If someone wish then he will expand advanced option and will check relative control from possible combination of control list. ( I am apologizing for my sentence. But I have just shared my thinking about Yii, Cause I love Yii so much ).

There for Yii developers have done a great job definitely no doubt about it. Not only great job but also they have been removed PHP developers may kind of pain and given them a waya of standard quality programming. Thanks Yii developer team for that.


View Postsamdark, on 08 May 2012 - 02:03 AM, said:

Idea of adding type-based generation to Gii was there for a long type. It sounds very cool at first but there are problems.

1. We don't know what type of input we should generate. For example, it's not clear if we should generate checkboxes, radios or just a textfield for enum. What's bad is that it will be very annoying if we'll generate wrong types all the time and developer will have to change more complex code.
2. Gii have custom templates support so one can create his own templates with all necessary checks.
3. Adding CKEditor or TinyMce is definitely a bad idea. It's up to developer to decide which one to use and if it should be used at all.

0

#8 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 08 May 2012 - 08:10 AM

masum
Yeah, this way it makes sense.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#9 User is offline   mmx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 20-June 11
  • Location:Virginia Beach, VA USA

Posted 19 February 2014 - 06:33 PM

Been generating modules, then models, then CRUD or controllers with Gii for the past week while creating a new version of an application for work based of Yii2 to replace an older 1.1.x version. Gii still can't generate CRUD for nested modules although it does a nice job of generating nested modules, models and controllers based on paths. For some odd reason, Gii is generating views of multi-word camelCase views with hyphens separating the view file words. However, the generated CRUD fails to recognize the hyphens and they need to be removed before the CRUD code runs debug free.

View Postsamdark, on 08 May 2012 - 02:03 AM, said:

Idea of adding type-based generation to Gii was there for a long type. It sounds very cool at first but there are problems.


This is what we are obligated to do--create useful solutions written with minimal amounts of code. There are always problems and for every problem are always numerous solutions. Cannot get much done if you do not keep an open mind and listen to your user base.


View Postsamdark, on 08 May 2012 - 02:03 AM, said:

1. We don't know what type of input we should generate. For example, it's not clear if we should generate checkboxes, radios or just a textfield for enum. What's bad is that it will be very annoying if we'll generate wrong types all the time and developer will have to change more complex code.


The model is already generated before the you attempt to generate the CRUD. Gii already knows what element it is going to assign to each table column based on data type. It should be possible to display a form with the various columns from the model along with drop down lists of possible alternative form elements. Then allow Gii to generate the CRUD based on a temporary file generated from the form selections.


View Postsamdark, on 08 May 2012 - 02:03 AM, said:

2. Gii have custom templates support so one can create his own templates with all necessary checks.


Sure, this is possible. But why not do it right in the first place to open up the possibilities.


View Postsamdark, on 08 May 2012 - 02:03 AM, said:

3. Adding CKEditor or TinyMce is definitely a bad idea. It's up to developer to decide which one to use and if it should be used at all.


Creating a single abstract Editor class or class implemented from an Interface and allowing developers to extend it to create wrappers for the various editors is possible. Look at the Joomla CMF framework as an example. Any number of js-based editors can be wrapped based on their solution. Do a search on the composer package list for 'editor'. There is at least one Joomla-like solution listed.
0

#10 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 20 February 2014 - 04:44 AM

Currently we don't have enough time to implement all these enhancements. Fill these to github and we'll handle these when more critical issues will be solved. Or submit pull requests. That's even better.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#11 User is offline   mmx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 20-June 11
  • Location:Virginia Beach, VA USA

Posted 20 February 2014 - 02:19 PM

View Postsaegeek, on 07 May 2012 - 10:25 AM, said:

How about a webpage like Gii to access and modify the config.php file ?


Are you speaking about automatically adding module entries to the configuration when the module code is generated? That is, a module needs to be declared in config before Gii generates CRUD for a module.

Or are you looking for something more sophisticated that can handle overall config file maintenance. This goes beyond the framework itself and is more of an application maintenance requirement. It probably should be handled using a module with the smarts to change file permissions and write configuration changes in a secure manner. This approach has been used in the past in 1.x extensions for parameters and with some minor tweaking for top level modules and module specific parameters. It involves using a database table with 'key' 'value' pairs. Anything more sophisticated needs to introduce a category-like hierarchy table to handle various parameter nesting levels as well as nested modules.

Curious about what you really want because I'm working on a solution for the later and will most likely do something to handle the former while working on some Gii templates.
0

#12 User is offline   mmx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 20-June 11
  • Location:Virginia Beach, VA USA

Posted 21 February 2014 - 05:27 PM

View Postsamdark, on 20 February 2014 - 04:44 AM, said:

Currently we don't have enough time to implement all these enhancements. Fill these to github and we'll handle these when more critical issues will be solved. Or submit pull requests. That's even better.


Understand the time constraints and the need to solve more important issues. Have done a lot of volunteer work myself elsewhere.

I experimented with a solution for wrapping textarea using a helper extended from BaseHtml. I could only find two Yii2 editor extensions and need to make sure it works with more editors before posting code.

I just started researching the form element assignment issue and Gii templates. It's going to require a multi-part form template. Once the model is declared on the existing form, a list of table columns can be dynamically generated for the second part of the form. Maybe, you have some ideas for a better approach (e.g., a wizard-like sequence). The solution is probably going to require a helper to handle the population of dropdown lists for the various data types. Any advice from a user interface perspective would be appreciated.

I'm still not sure about the config issue mentioned above. I believe he was requesting the automatic addition of the module array in the main configuration file when the module code is generated, thus allowing CRUD to be generated after model generation without manually editing the config file. The big problem here is application specific config file naming and the existence of multiple sets of config files. There is also the possibility that the developer may have parted out the module array into a separate config file.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users