Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT: I've re-read your question, and I'm not sure if I entirely covered off what you're asking. Nevertheless the information applies somewhat so I'll leave it here. However I think your question is regarding best practice for adding attributes to existing entities. Specifically on that point, It's perfectly acceptable to use setup resources to add attributes to things, EAV or otherwise. You can use functions like <code>Mage_Eav_Model_Entity_Setup::addAttribute()</code> to this end, or use <code>Mage_Core_Model_Resource_Setup::run()</code> to modify tables with SQL queries as required.</p> <p>Original answer:</p> <p>It's possible to use multiple resources within the same module, so this should be sufficient to do what you're asking. </p> <p>It's pretty straightforward in fact, just define two setup resources and Magento will run both.</p> <p>in your config.xml:</p> <pre><code>&lt;config&gt; ... &lt;global&gt; ... &lt;resources&gt; &lt;!-- Resource 1 --&gt; &lt;mymodule_setup&gt; &lt;setup&gt; &lt;module&gt;MyCompany_MyModule&lt;/module&gt; &lt;/setup&gt; &lt;connection&gt; &lt;use&gt;core_setup&lt;/use&gt; &lt;/connection&gt; &lt;/mymodule_setup&gt; &lt;mymodule_write&gt; &lt;connection&gt; &lt;use&gt;core_write&lt;/use&gt; &lt;/connection&gt; &lt;/mymodule_write&gt; &lt;mymodule_read&gt; &lt;connection&gt; &lt;use&gt;core_read&lt;/use&gt; &lt;/connection&gt; &lt;/mymodule_read&gt; &lt;!-- Resource 2 --&gt; &lt;mymodule2_setup&gt; &lt;setup&gt; &lt;module&gt;MyCompany_MyModule&lt;/module&gt; &lt;/setup&gt; &lt;connection&gt; &lt;use&gt;core_setup&lt;/use&gt; &lt;/connection&gt; &lt;/mymodule2_setup&gt; &lt;mymodule2_write&gt; &lt;connection&gt; &lt;use&gt;core_write&lt;/use&gt; &lt;/connection&gt; &lt;/mymodule2_write&gt; &lt;mymodule2_read&gt; &lt;connection&gt; &lt;use&gt;core_read&lt;/use&gt; &lt;/connection&gt; &lt;/mymodule2_read&gt; &lt;/resources&gt; ... &lt;/global&gt; ... &lt;/config&gt; </code></pre> <p>Then include the necessary install/upgrade files in <code>app/code/local/MyCompany/MyModule/sql/mymodule_setup</code> and <code>app/code/local/MyCompany/MyModule/sql/mymodule2_setup</code></p> <p>You can even add your own functions to the installer by extending the setup model. You do this by adding a class tag to:</p> <pre><code>&lt;resources&gt; &lt;mymodule2_setup&gt; &lt;setup&gt; </code></pre> <p>like this:</p> <pre><code>&lt;class&gt;MyCompany_MyModule_Entity_Setup&lt;/class&gt; </code></pre> <p>and create a file at <code>app/code/local/MyCompany/MyModule/Entity/Setup.php</code></p> <p>that looks like this:</p> <pre><code>&lt;?php class MyCompany_MyModule_Entity_Setup extends Mage_Eav_Model_Entity_Setup { } </code></pre> <p>So as you suspected, you're going to need to extend Mage_Core_Model_Resource_Setup or Mage_Eav_Model_Entity_Setup (eav).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload