Auto generate model view ...

#1
[eluser]zorrito[/eluser]
Hello.

With cakephp we can use "bake" to auto generate view model ....
Is it possible on codeigniter to do the same thing?

Thanks a lot.

#2
[eluser]Aken[/eluser]
I'm not understanding the terminology here. A model and a view are two separate components. How can you make a view model?

Perhaps someone else is also familiar with CakePHP and can elaborate, cause I'm lost. Big Grin

#3
[eluser]garymardell[/eluser]
Hes talking about the command line autogeneration of files.
For example similar to ruby on rails the command line can be used to generate a controller, view and models
It can generate them as a package so you can generate controller site (index, display, go) and it will automatically make you the views corresponding to the functions you requested.

Anyways, back to the question.
I think there was talk of someone making something a long time ago similar but never came to life (i think).
Most people on here find that as codeigniter can be used in so many different ways (some people dont use models)
that there is no need for it to generate it. You can easily just write the file, especially if your editor supports snippets i have a shortcut that will insert the code for the controller.

#4
[eluser]zorrito[/eluser]
Quote:Hes talking about the command line autogeneration of files.

Yes Smile

For example with cake if i had a table 'post', i create a Post Controller and the bake auto generate for me view, add, edit, delete function for the controller.

View, add, edit, delete are always similar.

#5
[eluser]jedd[/eluser]
Do you mean something like CodeCrafter?

[url="http://codeigniter.com/wiki/Category:Advanced::CRUD/"]Here's the wiki entry[/url] though it might not be what you're after (presumably you already searched the wiki & forums, and perhaps have already discounted this software).

#6
[eluser]Wittner[/eluser]
Have you tried the scaffolding technique built into CodeIgniter? I've not used it my self but I *think* it allows you to quickly construct (bake) crud pages without having to code the whole thing. You can then edit the views to suit,

cheers,

Wittner

#7
[eluser]BrianDHall[/eluser]
CodeIgniter itself doesn't use the command line at all, so there are no batch or functions like autogeneration of files, database creation, etc - for better or for worse, depending on your personal preferences.

In CI, unlike in cake/symphony/rails, databases are created directly by you (using a tool like phpmyadmin or whatever method you prefer), and MVC files are generated manually. Most of us who have used CI for awhile have a template or snippit in our IDE/editor so we only have to type the stuff that's important - like changing the class and constructor name, etc.


I haven't tried scaffolding at all, so you might look into that, but I wanted to pass along a suggestion I found useful.

Using Object Relationship Management - ORM - I have found largely eliminates the need for generating the same CRUD functions entirely. You setup your model for each table in the database, code a few custom functions you'll need (like my User table/model has a login and logout function), and your off.

Its saved me a lot of time - not directly an answer to your question, just a suggestion as lots of people think ORM isn't in CI because it isn't included 'out of the box'. I personally reccommend http://www.overzealous.com/dmz/ - the Overzealous extension to DataMapper.

#8
[eluser]zorrito[/eluser]
Thanks all!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.