I've got the following left join in my _prepareCollection();
method:
$collection->getSelect()->joinLeft(
array('views_index' => "my_views_table"),
'views_index.entity_id = main_table.entity_id',
array('views'=>'count')
);
And then in my _prepareColumns()
method I have:
$this->addColumn('views',
array(
'header'=> $this->__('Views'),
'index' => 'views',
'width' => '5%',
'filter_index' => 'views_index.count'
)
);
When I load this page though, I get an error:
Item (Namespace_Module_Model_Mymodel) with the same id "{ID}" already exist
How is this conflict occurring?
Some background: Magento Custom Grid Redirect Error (On Join Attributes ONLY)Magento Custom Grid Redirect Error (On Join Attributes ONLY)
Would appreciate any help
Edit 1 The my_views_table
consists of 3 columns, namely:
- id (primary key)
- entity_id
- count