1
votes

I'm trying to create a custom module using Magento's EAV structure and have been using this tutorial as a guide: http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-7-advanced-orm-entity-attribute-value

Everything seems to be working except my install script is always failing on trying to create the _text table. It creates the first 3 - entityname_datetime, entityname_int and entityname_decimal and then throws the exception: Can't create table: entityname_text from the core resource setup model.

I've tried changing the table name but it fails at the same point. Except for changing the model and entity names, my code exactly mirrors that from the tutorial.

Any tips for debugging? Using Mage::log within the core resource setup model doesn't seem to be working, though I can't fathom why.

3
post the code in the install script. Log must beactivated in admin > system > configuration > developer - user971401

3 Answers

2
votes

This is bug that was recently introduced to the Community Edition version of the product. It's been reported to the core team via their public-with-a-login bug tracker. For now I'd skip creating non-varchar text types and continue working your way through the tutorial. (not ideal, but as the tutorial suggests, you'll it's a rare use-case that calls for a scratch EAV model)

1
votes

after changing table name have u tried removing entry from core_resource table of your module and clearing the cache? btw, what name you are using?

0
votes

solution by Magento Team bug report reference link

class Namespace_Modulename_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
{
    public function createEntityTables($baseTableName, array $options = array())
    {
        ...

        /**
         * DDL operations cannot be executed within transaction so these lines are useless
         */
        //$connection->beginTransaction();
        try { 
            foreach ($tables as $tableName => $table) {
                $connection->createTable($table);
            }
            $connection->commit();
       } catch (Exception $e) {
           //$connection->rollBack();
           throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Can\'t create table: %s', $tableName));
       }
    }
}