I'm trying something very simple:
$categoryCollection = Mage::getModel('catalog/category')
->getCollection();
$categoryCollection
->addAttributeToSelect('name')
->addAttributeToFilter('entity_id', array('in' => array(1,2,3,4)));
I would expect to have this query when doing $categoryCollection->getSelect()->__toString()
SELECT
main_table
.name
FROMcatalog_category_flat_store_1
ASmain_table
WHERE (entity_id
IN(1, 2, 3, 4));
Instead of that I get this:
SELECT
main_table
.entity_id
,main_table
.level
,main_table
.path
,main_table
.position
,main_table
.is_active
,main_table
.is_anchor
,main_table
.name
FROMcatalog_category_flat_store_1
ASmain_table
WHERE (entity_id
IN(1, 2, 3, 4));
Why is adding the extra columns, when I explicitly say I want only name, also what is the correct way of doing this?