1

Getting error

"Craft\Import_HistoryRecord and its behaviors do not have a method or closure named "type".  

Import_HistoryRecord is one of the Plugin Files in the "records" folder.

<?php
namespace Craft;

class Import_HistoryRecord extends BaseRecord
{

    public function getTableName()
    {
        return 'import_history';
    }

    protected function defineAttributes()
    {
        return array(
            'type'     => AttributeType::String,
            'file'     => AttributeType::Name,
            'rows'     => AttributeType::Number,
            'behavior' => array(AttributeType::Enum, 'values' => array(ImportModel::BehaviorAppend, ImportModel::BehaviorReplace, ImportModel::BehaviorDelete)),
            'status'   => array(AttributeType::Enum, 'values' => array(ImportModel::StatusStarted, ImportModel::StatusFinished, ImportModel::StatusReverted))
        );
    }

    public function defineRelations()
    {
        return array(
            'user' => array(static::BELONGS_TO, 'UserRecord',       'onDelete' => static::CASCADE, 'required' => false),
            'log'  => array(static::HAS_MANY,   'Import_LogRecord', 'logId')
        );
    }

}

It worked a month ago when I used it, don't think I am doing anything differently.

1

The developer recently added multiple types of import - Entry, User and Category.

Your import history in the database saved prior to this recent update - I think the db table is called craft_import_history or similar - doesn't have a type saved against so an error is being thrown.

Edit the rows in that table directly and either delete them or edit the type column and add the correct value.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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