CRUDifier - richjoslin/rivety GitHub Wiki
The CRUDifier is a command-line PHP script that uses the Zend Framework to introspect a database table and then spits out a bunch of files into specific locations based on your custom module. Those files can then be used for easily managing the contents of that database table from within Rivety.
The file lives here: [webroot]/core/default/bin/crudifier.php
To execute the command, make sure PHP is enabled from the command line. On some systems, it is not enabled by default. Here is what executing the command looks like with both arguments present:
$ php [webroot]/core/default/bin/crudifier.php mymodulename_custom_db_table 1
There are two arguments that can be passed to the script. The first is the database table name, and that is required. The second is a boolean value (usually just 1 or nothing at all) which indicates if the web pages should be generated on the admin side (1) or the frontend side (0 or nothing).
IMPORTANT: The crudifier expects your database table to be named in this specific way:Example: mymodulename_player_inventory_item
- all lowercase
- module name first with no spaces
- followed by an underscore
- followed by whatever you want (but we have these Database Naming Recommendations)
The files generated are:
- One Model File
- [webroot]/modules/yourmodule/models/YourCustomModel.php
- Class Structure: Zend_Db_Table : RivetyCore_Db_Table_Abstract : YourCustomModel
- One Controller File
- [webroot]/modules/yourmodule/controllers/YourmodelnameController.php
- Class Structure if Frontend:
Zend_Controller_Action : RivetyCore_Controller_Action_Abstract : Yourmodule_YourmodelnameController - Class Structure if Admin:
Zend_Controller_Action : RivetyCore_Controller_Action_Abstract : RivetyCore_Controller_Action_Admin : Yourmodule_YourmodelnameadminController
- Three View Files (Smarty Templates)
- [webroot]/modules/yourmodule/views/[admin]/tpl_controllers/yourtable[admin?]/index.tpl
- [webroot]/modules/yourmodule/views/[admin]/tpl_controllers/yourtable[admin?]/edit.tpl
- [webroot]/modules/yourmodule/views/[admin]/tpl_controllers/yourtable[admin?]/delete.tpl