TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
code generator
  • I am quite new to kohana and i think it is a very good simple and clean framework.

    Said that one of the things i fell most lack of is some code generation (like other fw out there) because all backoffice projects tend to have a lot of grids for displaying, filtering (...) data and a lot of forms for editing data. The time spent in generating the (almost same) code over and over before really starting serious developing is quite annoying (my opinion)...

    so i wonder what good modules for this task are out there?

    I am developing a code generator for kohana 3.3 (models, views, controllers) for my personal projects. The code generated can be easily costumized by changing the view templates. I don't know if this would be the best approach or if there is allready modules for this.

    can be tested here: http://nunochaves.com/ko33demo/index.php/codegen

    tell me what u think of this. thanks.

  • Seems to egnerate quite a lot of code, can you describe briefly what does it generate? Seems like some sort of editing pages for the models

  • it that example i costumized the controller and views code to generate a grid with jquery datatables plugin and a form in a lightbox. the views in the module are just templates and can be deleted or changed to suit different projects.


    action_index() : display the grid header and whatever we want to add. action_browse() : ajax action that uses datatables module to retrive data from db. there should be one of this actions per grid in the page action_edit() : renders and handles form post calling model validation and model save action_delete() : ajax action to delete one record. called from the grid.

    check out a demo here: http://nunochaves.com/ko33demo/index.php/admin/auth user: admin pass: admin

  • looks nice for creating crud for simple pages. sources are coming soon? :)

  • Hmm for such a purpose i'd rather usea generic controller that takes a model, looks into its columns and shows the ui. Imho there's little need to create separate classes for that. Especially since you can use a generic ui for each of entity.

  • Like i said this is just to generate the initial code to start the project. the controllers, views have to be costumized after generation to suit project need and business rules. Having a generic controller to take a module and generate a the ui can be limiting and if you want some costumization you have to stuff the models with code or have other files with metadata for that pourpose.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion