Skip to content
vsushkov edited this page May 4, 2011 · 2 revisions

module tools

create module

Syntax:
zf create mage-module
Will ask for:
company name: Company
module name: Mymodule

One line syntax:
zf create mage-module company/module

Will create:
Folder app/code/local/Company/Mymodule/etc
File config.xml with default content
File app/etc/modules/Company_Mymodule.xml with default content

install module

Syntax:
zf install mage-module
Will ask for:
target module: mycompany/mymodule initial module version: 1.0.0

Oneline syntax:
zf install mage-module mycompany/mymodule 1.0.0

Will create:
Folder app/code/local/Company/Mymodule/sql/mycompany_mymodule_setup
File mysql4-install-1.0.0.php with default content
Entry with initial version in module config.xml file
Entry with setup resource in config.xml file

upgrade module

Syntax:
zf upgrade mage-module
Will ask for:
target module: mycompany/mymodule how to upgrade (exact version r increment): ”to” or “inc” -- in case of “to” module version: 1.0.0 -- in case of “inc” increment version mask: ..1 - will increment to 1 in 3rd segment

Oneline syntax:
zf upgrade mage-module mycompany/mymodule to 1.0.0
or
zf upgrade mage-module mycompany/mymodule inc *.*.1

Will create:
File mysql4-upgrade-x.x.x-y.y.y.php with default content
Entry with new version in module config.xml file


entities tools

add

  1. model
  2. block
  3. helper

add model

Syntax:
zf add mage-model Will ask for:
model path: mymodule/trololo_upyachka Oneline syntax:
zf add mage-model mymodule/trololo_upyachka

Mage tool will try to automatically find local module with models namespace defined in the argument (mymodule). If such namespace will not be found in any local module mage tool will ask for the exact module and will create the namespace there.
Will create:
Folder app/code/local/Company/Mymodule/Model if not exist
File app/code/local/Company/Mymodule/Model/Trololo/Upyachka.php with class content

add block

Syntax:
zf add mage-block
Will ask for:
block path: mymodule/trololo_upyachka Oneline syntax:
zf add mage-block mymodule/trololo_upyachka

Mage tool will try to automatically find local module with blocks namespace defined in the argument (mymodule). If such namespace will not be found in any local module mage tool will ask for the exact module and will create the namespace there.
Will create:
Folder app/code/local/Company/Mymodule/Block if not exist
File app/code/local/Company/Mymodule/Block/Trololo/Upyachka.php with class content

add helper

Syntax:
zf add mage-helper
Will ask for:
helper path: mymodule/trololo_upyachka
Oneline syntax:
zf add mage-helper mymodule/trololo_upyachka

Mage tool will try to automatically find local module with helpers namespace defined in the argument (mymodule). If such namespace will not be found in any local module mage tool will ask for the exact module and will create the namespace there.
Will create:
Folder app/code/local/Company/Mymodule/Helper if not exist
File app/code/local/Company/Mymodule/Helper/Trololo/Upyachka.php with class content


rewrite

  1. model
  2. block
  3. helper
  4. resource model
  5. action - coming soon

rewrite model

Syntax:
zf rewrite mage-model
Will ask for:
module: Company/Mymodule rewrite model path: catalog/product your model path (without namespace): catalog_product

Oneline syntax:
zf rewrite mage-model company/mymodule catalog/product catalog_product

Will create:
Folder app/code/local/Company/Mymodule/Model if not exist
File app/code/local/Company/Mymodule/Model/Catalog/Product.php with class content
Rewrite rules in the module config.xml

rewrite block

Syntax:
zf rewrite mage-block
Will ask for:
module: Company/Mymodule
rewrite block path: catalog/product_view
your block path (without namespace): catalog_product_view

Oneline syntax:
zf rewrite mage-block company/mymodule catalog/product_view catalog_product_view

Will create:
Folder app/code/local/Company/Mymodule/Block if not exist
File app/code/local/Company/Mymodule/Block/Catalog/Product/View.php with class content
Rewrite rules in the module config.xml

rewrite helper

Syntax:
zf rewrite mage-helper
Will ask for:
module: Company/Mymodule rewrite helper path: customer/data your helper path (without namespace): customer_data

Oneline syntax:
zf rewrite mage-helper company/mymodule customer/data customer_data

Will create:
Folder app/code/local/Company/Mymodule/Helper if not exist
File app/code/local/Company/Mymodule/Helper/Customer/Data.php with class content
Rewrite rules in the module config.xml

rewrite resource model

Syntax:
zf rewrite mage-rmodel
Will ask for:
module: Company/Mymodule rewrite model path: catalog/product_collection your model path (without namespace): catalog_product_collection

Oneline syntax:
zf rewrite mage-rmodel company/mymodule catalog/product_collection catalog_product_collection

Will create:
Folder app/code/local/Company/Mymodule/Model if not exist
File app/code/local/Company/Mymodule/Model/Catalog/Product/Collection.php with class content
Rewrite rules in the module config.xml


create (it’s just a bit more strict form of add)

  1. model
  2. block
  3. helper
  4. action - coming soon

create model

Syntax:
zf create mage-model
Will ask for:
module: Company/Mymodule model path: mymodule/trololo_upyachka

Oneline syntax:
zf create mage-model company/mymodule mymodule/trololo_upyachka

Will create:
Folder app/code/local/Company/Mymodule/Model if not exist
File app/code/local/Company/Mymodule/Model/Trololo/Upyachka.php with class content
Models namespace mymodule in the module config.xml if not exists

create block

Syntax:
zf create mage-block

Will ask for:
module: Company/Mymodule block path: mymodule/trololo_upyachka

Oneline syntax:
zf create mage-block company/mymodule mymodule/trololo_upyachka

Will create:
Folder app/code/local/Company/Mymodule/Block if not exist
File app/code/local/Company/Mymodule/Block/Trololo/Upyachka.php with class content
Blocks namespace mymodule in the module config.xml if not exists

create helper

Syntax:
zf create mage-helper
Will ask for:
module: Company/Mymodule helper path: mymodule/trololo_upyachka

Oneline syntax:
zf create mage-helper company/mymodule mymodule/trololo_upyachka

Will create:
Folder app/code/local/Company/Mymodule/Helper if not exist
File app/code/local/Company/Mymodule/Helper/Trololo/Upyachka.php with class content
Helpers namespace mymodule in the module config.xml if not exists.