Yii Framework Forum: What is the point of the CLI webapp generator? - Yii Framework Forum

Jump to content

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

What is the point of the CLI webapp generator? Rate Topic: -----

#1 User is offline   Jakobud 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 12-December 11

Posted 26 April 2012 - 12:50 PM

I'm new to Yii. I'm eager to learn and understand several things about it. First off, I'm trying to understand what the point is, of using the CLI to generate a webapp.

Following along in various tutorials, after downloading Yii, the first thing you do is generate the default webapp with the CLI tools. If generating the webapp always generates the exact same code every time you use it, then what is the point of generating it? Why isn't the webapp code just included in the source that you download and "install" on your webserver? Generating something implies that you are using a creating something that is going to be different depending on a bunch of input variables. But the generator makes the same thing. Every time. What is the point of that?

The only thing I can think of is that it's possible to customize the webapp template so that you can maybe generate different types of webapps? I could see that being helpful. Is this possible? If not, back to the original question. What is the point?
0

#2 User is offline   bluyell 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 28-October 11

Posted 26 April 2012 - 12:56 PM

Gii Generator is customizable, you can create your own templates and use them on your projects.

As an example,

If you have specific requirements on your model, then create a customized model in Gii templates for this projects or others.

In my case, i have my own:


class CMyActiveForm extends CActiveForm {
}

then, every time i need a CRUD, it will be created using my own template, and this template use CMyActiveForm and takes advangate using my own methods.
0

#3 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,165
  • Joined: 05-January 12
  • Location:Morocco

Posted 26 April 2012 - 01:05 PM

@Jakobud: I think one advantage of using CLI webapp generation ensures that (at the time you use it) relative paths in index.php for instance are correct.

@bluyell: A little note: Question is about CLI not Gii

Edit:

Quote

The only thing I can think of is that it's possible to customize the webapp template so that you can maybe generate different types of webapps? I could see that being helpful. Is this possible?


That makes sense. I just dived in yiic and yiic.php when using console (for crons) and it seems customizable
0

#4 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 26 April 2012 - 01:40 PM

The point is ...

Take a look at 'WebAppCommand.php' in yii/framework/cli/commands/ and it should be revealed to you what it does. :)

What I usually do is create another 'CostomAppCommand.php' in that folder and add a new directory in yii/framework/cli/views/ which contains a set of files which usually makes up the web apps that I want generated.

And then I just do a yiic customapp blahblah instead.
"Less noise - more signal"
0

#5 User is offline   Islam500 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 26-October 12

Posted 18 May 2013 - 11:08 PM

Perhaps it will be a good idea to add a functionality for crating application profiles that developers can install and get started. similar to Drupal
0

#6 User is offline   mem 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 16-December 11

Posted 17 January 2014 - 04:29 PM

Let me re-take the OP question here:

What would the main benefit of Option a) be:

"Using customWebApp to generate those applications"?

over

Option b):
"Create several application types" clone (or copy/paste them) and change accordingly.


Taking into consideration that:

1) you still have to change the main.php configuration file accordingly (like db access, etc), on option a as well.
2) you don't (at least I don't see where) have to change any PATH on option b. Some of you do talk about PATH benefits, I don't recall, on option b, of any PATH that needs to be edited.

What is, again, the true benefit of using webapp or custom webapp, over clone or copy/paste, even on "several base applications" scenarios?"

What am I not seeing?
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