I followed this article: http://inchoo.net/magento/creating-an-eav-based-models-in-magento/

I created the Inchoo Blog module, after the firt time it ran the controller code the situation on the database is the following:

value_id | entity_type_id | attribute_id | store_id | entity_id | value
1        |      10        |     142      |     0    |    1      | Test title
2        |      10        |     143      |     0    |    1      | Zoran

Then I changed the controller, in this way:

class Inchoo_Blog_IndexController extends Mage_Core_Controller_Front_Action
public function indexAction()

$post = Mage::getModel('inchoo_blog/post')->load(1);
$post->setTitle('Test title2');
$post->setAuthor('Zoran Šalamun2');



I wanted to change the values in the database, but the result was as follows: enter image description here

How should I do if I want to update those values and not add more?

1 Answer 1


Theoretically you should not be able to add the 2 lines for the same attribute_id, store_id and entity_id.
If you can, this means that there is no unique index those fields for your tables.

When creating the attributes tables inchoo_blog_post_entity_datetime, inchoo_blog_post_entity_decimal, inchoo_blog_post_entity_int, inchoo_blog_post_entity_text, inchoo_blog_post_entity_varchar, inchoo_blog_post_entity_char you need to add this before setting the comment (->setComment('....');).

            array('inchoo_blog/post', 'int'), //`int` is for the int table. for other tables change to `varchar`, `text` and so on
            array('entity_id', 'attribute_id', 'store_id'),
        array('entity_id', 'attribute_id', 'store_id'),
        array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)

As a recommendation for the future, you can create your eav entities using this free extension. It takes care of everything. Features and documentation can be found here

  • Marius, i use: $installer->installEntities(); I did not use that script
    – tonyB
    Commented Aug 11, 2015 at 15:45
  • Marius doesn't work
    – tonyB
    Commented Aug 11, 2015 at 15:53
  • There is an error, array('inchoo_blog/post', 'int'), -> array('inchoo_blog/post_entity', 'int')
    – tonyB
    Commented Aug 11, 2015 at 15:54
  • Here's another, more verbose, answer to the same problem.
    – stollr
    Commented Sep 9, 2016 at 13:12

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.