0

Error in file: "/var/www/test/magento_custom/app/code/community/Fabric/Material/data/fabric_material_setup/data-install-1.0.0.0.1.php" -Warning: include(/var/www/test/magento_custom/includes/src/Fabric_Material_Model_Material.php): failed to open stream: No such file or directory in /var/www/test/magento_custom/includes/src/Varien_Autoload.php on line 94

I am having this issue, when install custom module. What would be the issue?

sql setup file.

$installer = $this;

/**
 * Creating table fabric_news
 */
$table = $installer->getConnection()
    ->newTable($installer->getTable('fabric_material/material'))
    ->addColumn('news_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'unsigned' => true,
        'identity' => true,
        'nullable' => false,
        'primary'  => true,
    ), 'Entity id')
    ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
        'nullable' => true,
    ), 'Title')
    ->addColumn('author', Varien_Db_Ddl_Table::TYPE_TEXT, 63, array(
        'nullable' => true,
        'default'  => null,
    ), 'Author')
    ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '2M', array(
        'nullable' => true,
        'default'  => null,
    ), 'Content')
    ->addColumn('image', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
        'nullable' => true,
        'default'  => null,
    ), 'News image media path')
    ->addColumn('published_at', Varien_Db_Ddl_Table::TYPE_DATE, null, array(
        'nullable' => true,
        'default'  => null,
    ), 'World publish date')
    ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
        'nullable' => true,
        'default'  => null,
    ), 'Creation Time')
    ->addIndex($installer->getIdxName(
            $installer->getTable('fabric_material/material'),
            array('published_at'),
            Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX
        ),
        array('published_at'),
        array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
    )
    ->setComment('Material item');

$installer->getConnection()->createTable($table);

data setup file.

$installer = $this;

/**
 * @var $model Fabric_News_Model_News
 */
$model = Mage::getModel('fabric_material/material');

// Set up data rows
$dataRows = array(
    array(
        'title'          => 'Cotton',
        'content'        => '<p>Suitable for very sunny climate</p>',
        'created_at'=>'2015-02-13 13:14:47'
    ),
     array(
        'title'          => 'Synthetic',
        'content'        => '<p>Suitable for very sunny climate</p>',
        'created_at'=>'2015-02-13 13:14:47'
    )
);
// Generate news items
foreach ($dataRows as $data) {
    $model->setData($data)->setOrigData()->save();
}

3 Answers 3

1

I found answer from below link. The Problem is that I enabled compilation in

System->Tool->compilation.

That is why, Magento duplicate everything in modules into src. Because of this, Errors have come.

Answer Here

0
0

In your setup file, you have this code

$table = $installer->getConnection()
    ->newTable($installer->getTable('fabric_material/material'))
    ...

Here $installer->getTable('fabric_material/material') is actually trying to get your model file.

Here Magento is generating your model class name as Fabric_Material_Model_Material and then looking for it through a bunch of directories and couldnt find that file any where. That is what the error says.

Fix is simple. You need to define Material entity inside your custom module Fabric_Material. (I hope such module does exist !) In fact, without having a model, you cant do any sort of database operation.

If you are followed magento best practices and conventions, then you need to define this file

File : app/code/local/Fabric/Material/Model/Material.php

<?php
class Fabric_Material_Model_Material extends Mage_Core_Model_Abstract
{
     protected function _construct()
    {
        $this->_init('fabric_material/material');
    }
}

Similarly you may need to setup a model resource for your module. Because you are dealing with database operations. So my advice is go through Magento Models and ORM Basics and make a good understanding and then proceed

0

Go to this file

includes/src/Varien_Autoload.php

Go to line 94.
There is the problem.

1
  • Hi @Prashanta Fabric_Material_Model_Material.php this placed in model folder but it loaded from magento include/src.how to fix this? Commented Mar 4, 2015 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.