Need to know the name of an EAV table that an attribute is stored in? Get an instance of the model class
$customer = Mage::getModel('customer/customer');
and then get a reference to its resource object
$entity = $customer->getResource();
use the eav/config
service model’s getCollectionAttribute
method to create an instance of the attribute object
$attribute = Mage::getSingleton('eav/config')->getCollectionAttribute($entity->getType(), 'firstname');
and then call the attribute object’s getBackendTable
method.
var_dump($attribute->getBackendTable());
My main use for this is when I need to write custom queries for reporting and want to be absolutely sure I’m getting the right table. Of course, I’m also going to need the attribute ID if I want to grab the right row. That’s available via
$attribute->getId()