====== uScaffold ======
===== What is it? =====
uScaffold is a simple Magento extension that was created for personal use to assist with rapid prototyping of custom Magento extensions.
It will attempt to generate a standard Magento configuration based on simple hints from custom extension declaration XML file.
This extension is geared towards developers, who are learning Magento or just wish to speed up their extension development.
===== How do I get it? =====
Download the archive from this link and unpack into Magento root folder:
http://download.unirgy.com/Unirgy_Scaffold-latest.zip
Disable or refresh cache as needed.
===== How does it work? (by example) =====
==== Initialize extension with uScaffold support ====
After installation of the extension, create a new file as you would normally do for a custom extension:
truelocal
After you save, uScaffold will generate basic configuration for the module, which encompasses models, helpers and blocks.
Now you can just create PHP files as you usually would do for magento, without worrying about the configuration for them.
Take note: You DO NOT need to create ''app/code/local/Custom/Extension/etc/config.xml''.
The models, helpers and blocks are referenced by the ''code'' attribute, in this case ''customext''.
If you do not have any special logic for helper, you do not need to create Helper/Data.php file, and still use ''__('...') ?>'' in your blocks.
==== Working with DB tables ====
Your module needs DB tables support?
No problem.
...
...
All the configuration for setup, read and write connections are made automatically, using core DB connections.
If ''table'' attribute is not specified, the table name will be the same as table entity code (''test1'').
==== Event observers ====
...
...
Doing the above will generate configuration to trigger an observer from your PHP model. All you have to do is to add this file:
==== Frontend development ====
...
...
BAM! layout updates are loaded from ''layouts/customext.xml'' and translations are loaded from ''Custom_Extension.csv''
Do you need to run controllers for your module?
...
...
Frontend only events?
...
...
NOTE: frontend specific observer method should start with ''FRONTEND_'':
public function FRONTEND_customer_load_after($observer)
{
//...
}
==== Admin development ====
Similar to frontend:
...
...
NOTE: admin specific observer method should start with ''ADMIN_'':
public function ADMIN_customer_load_after($observer)
{
//...
}
But wait, there's more!
...
...
The code above will create admin menu entry and related ACL entry.
===== Moving from scaffolding to production =====
The uScaffold is not made for the production deployment, and as such is not recommended to be bundled with your extensions.
To retrieve automatically generated configuration, add ''output'' attribute to your scaffold declaration:
...
...
Refresh the page and you'll find ''var/uscaffold/Custom_Extension/config.xml'' file, containing the full Magento config file.
Just copy it to ''app/code/local/Custom/Extension/etc/config.xml'', and you're ready for production!
===== Wishlist =====
* etc/system.xml scaffolding
* Automatic emulation of basic model classes (Model/*, Model/Mysql4/*, Model/Mysql4/Collection/*)
===== FAQ =====
== Why the method names for event observers are not in Zend convention? ==
In my personal experience it is much easier to maintain event observers and method names when they're the same.
Usually they're in 1-to-1 relationship and making them different names only adds to complexity
== Why not to use admin routers as additional modules? ==
There are still many stores that run Magento 1.3.x, where admin router modules are not available.
I was trying to make the scaffold as compatible as possible.
Most probably, in future versions it will be replaced with admin router modules or added as a configuration option.
===== Example uScaffold configuration vs full Magento configuration =====
==== uScaffold configuration ====
truelocal
==== Automatically generated full Magento configuration ====
Custom_Extension_Modelcustomext_mysql4Custom_Extension_Model_Mysql4