How to Define Custom/Use Custom Resource Methods in Installation Scripts
Question
What's the proper way to define functions used in installation scripts? I have a long list of data to add in a module, and I'd like to avoid writing a long serial script or just including functions at the bottom or top of the installation script files.
Specifically, I'm wondering if there's a .php
file that can be included for the data
or sql
scripts.
UPDATE: See my answer.
Solution 2
Under the resources
node for the installation script, you can define your own class to be used. $this
, then, in the installation script will be of class Mage_Catalog_Model_Resource_Catalog_Setup
in this example.
<resources>
<abc_setup>
<setup>
<module>Test_Abc</module>
<class>Mage_Catalog_Model_Resource_Catalog_Setup</class>
</setup>
</abc_setup>
</resources>
OTHER TIPS
The best way should be using an own Setup.php.
You may use http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources as an entry point.