title: Product Flat Data Error - PHP Fatal Error: Call to member function reindexAll() on a non-object
body: <p>I was having a problem with the row limit in MySQL because of the amount of attributes in a Magento install, so I put together an extension that extended the 'Mage_Catalog_Model_Resource_Product_Flat_Indexer' class to rewrite the char limit to 64 using the following code.</p>
  
  <pre><code>protected function _MySQLCharLimit()
  {
      if (!$this-&gt;_isFlatTableExists($store)) {
  
          $sql = "CREATE TABLE {$tableNameQuote} (n";
  
          foreach ( $columns as $field =&gt; $fieldProp ) {
              if ( $fieldProp['type'] == "varchar(255)" )
              $fieldProp['type'] = "varchar(64)";
                  $sql .= sprintf( "  %s,n",
                  $this-&gt;_sqlColunmDefinition( $field, $fieldProp ) );
          }
          foreach ($addIndexes as $indexName =&gt; $indexProp) {
              $sql .= sprintf(' ADD %s,',
              $this-&gt;_sqlIndexDefinition( $indexName, $indexProp ) );
          }
          $sql = rtrim($sql, ",");
          $sql = str_replace( "varchar(255)","varchar(64)",$sql );
          $this-&gt;_getWriteAdapter()-&gt;query( $sql );
      }
  }
  </code></pre>
  
  <p>Which I got from here <a href="http://www.sonassi.com/knowledge-base/magento-kb/mysql-limitations-on-the-flat-catalogue-in-magento/" rel="nofollow">http://www.sonassi.com/knowledge-base/magento-kb/mysql-limitations-on-the-flat-catalogue-in-magento/</a>.</p>
  
  <p>After trying to reindex I noticed that it sent me to a blank page and when I clicked back the 'Product Flat Data' index was stuck on processing.</p>
  
  <p>I ran the indexer.php from the 'shell' folder via SSH and it reported this error:</p>
  
  <p>PHP Fatal Error: Call to member function reindexAll() on a non-object in Mage/Catalog/Model/Product/Flat/Indexer.php on line 296</p>
  
  <p>Has anyone got any idea on what has gone wrong or how I can rectify this? Thanks.</p>
  
  <p><strong>EDIT:</strong> Full Code</p>
  
  <pre><code>&lt;?php
  class GDModules_MySQLCharLimit_Catalog_Model_Resource_Product_Flat_Indexer extends Mage_Catalog_Model_Resource_Product_Flat_Indexer
  {
      public function mySQLCharLimit()
      {
          if (!$this-&gt;_isFlatTableExists($store)) {
  
              $sql = "CREATE TABLE {$tableNameQuote} (n";
  
              foreach ( $columns as $field =&gt; $fieldProp ) {
                  if ( $fieldProp['type'] == "varchar(255)" )
                  $fieldProp['type'] = "varchar(64)";
                      $sql .= sprintf( "  %s,n",
                      $this-&gt;_sqlColunmDefinition( $field, $fieldProp ) );
              }
              foreach ($addIndexes as $indexName =&gt; $indexProp) {
                  $sql .= sprintf(' ADD %s,',
                  $this-&gt;_sqlIndexDefinition( $indexName, $indexProp ) );
              }
              $sql = rtrim($sql, ",");
              $sql = str_replace( "varchar(255)","varchar(64)",$sql );
              $this-&gt;_getWriteAdapter()-&gt;query( $sql );
          }
      }
  }
  </code></pre>
  
  <p><strong>XML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!-- The root node for Magento module configuration --&gt;
  &lt;config&gt;
  
      &lt;!--
      The module's node contains basic
      information about each Magento module
      --&gt;
      &lt;modules&gt;
  
          &lt;!--
          This must exactly match the namespace and module's folder
          names, with directory separators replaced by underscores
          --&gt;
          &lt;GDModules_MySQLCharLimit&gt;
  
              &lt;!-- The version of our module, starting at 0.0.1 --&gt;
              &lt;version&gt;0.0.1&lt;/version&gt;
          &lt;/GDModules_MySQLCharLimit&gt;
      &lt;/modules&gt;
  
      &lt;!-- Configure our module's behaviour in the global scope --&gt;
      &lt;global&gt;
          &lt;!-- Defining models --&gt;
          &lt;models&gt;
              &lt;catalog_resource&gt;
                  &lt;rewrite&gt;
                      &lt;product_flat_indexer&gt;GDModules_MySQLCharLimit_Catalog_Model_Resource_Product_Flat_Indexer&lt;/product_flat_indexer&gt;
                  &lt;/rewrite&gt;
              &lt;/catalog_resource&gt;
          &lt;/models&gt;
      &lt;/global&gt;
  &lt;/config&gt;
  </code></pre>