modulegen Module generator - models controllers actions CRUD

  1. Documentation
  2. Change Log
  3. v1.0* Initial release.

This script have an interesting function that not have present on YIIC:

limit the number of table columns that you want display at the admin page of CRUD, imagine, you have 30 colummns in your table;

YIIC CRUD generate 30 large columns in the horizontal way of course out of lay-out

typing crudm mymod 5 {table_name}
this generate only 5 columns at the admin site and at the list action; (see the documentation)

This tool can help you to generate full working app module based from an existing mysql table (CRUD) and usefulls class under a module dir sctructure like default yiic generator for models controllers and cruds.
this code is a modified version of main shell files
ControllerCommand.php
CrudCommand.php
ModelCommand.php


modified files:
ControllermCommand.php
CrudmCommand.php
ModelmCommand.php

commands: crudm modelm controllerm

Resources

Documentation

Requirements
  • Yii 1.1 or above
  • not tested under 1.0 .????
Installation
  • Extract the release file under framework/cli/commands/shell/
Usage

See the following code example:

first crate a module using the module command:
module nodulename;
after this you can start using the following commands:
commands are: modelm,controllerm,crudm
ex for module called mymod and table called mytable:

module mymod
modelm mymod mytable
crudm mymod (number_cols) mytable (crudm mymod 5 mytable )
controllerm mymod oneaction anotheraction etc

crudm mymod 5 mytable 
OR
crudm mymod mytable

>> modelm help
Usage: modelm <moduleID> <class-name> [table-name] ...
This command generates a model class with the specified class name.
 * ModuleID: your module name directory
 * class-name: required, model class name. It can be specified in
   dot syntax (it defaults to application.models.class-name).
 * table-name: optional, the associated database table name. If not given,
   it is assumed to be the model class name.


>> controllerm
USAGE
  controllerm <moduleID> <controller-ID> [action-ID] ...

DESCRIPTION
  This command generates a controller and views associated with
  the specified actions.

PARAMETERS
 * ModuleID: your module name directory
 * controller-ID: required, controller ID (e.g. 'post', 'admin/user')
 * action-ID: optional, action ID. You may supply one or several
   action IDs. A default 'index' action will always be generated.

>> crudm
USAGE
  crudm <moduleID> <columns> <model-class> [controller-ID] ...

DESCRIPTION
  This command generates a controller and views that accomplish
  CRUD operations for the specified data model.

PARAMETERS
* ModuleID: your module name directory
* Columns: Number os columns to show at admin and list actions
 * model-class: required, the name of the data model class. This can
   also be specified using dot syntax (e.g. application.models.Post)
 * controller-ID: optional, the controller ID (e.g. 'post', 'admin.user').
   If absent, the model class name will be used as the ID.

Change Log

v1.2 30 MARCH crudm have option to limit the columns generated from table only for list and admin action, update,edit addnew work normal with full table columns.

March 29, 2009

v1.0* Initial release.

2 1
1 follower
1 083 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Console
Tags:
Developed by: megabr
Created on: Mar 29, 2009
Last updated: 15 years ago

Downloads

show all