If you have a model, normally there should be a resource model and a resource collection too, but there are some core models where this is not the case.
Example: Mage_Log_Model_Customer
I tried to answer another question and thought its possible to get data from this models collection directly ...
$model = Mage::getModel('log/customer')->getCollection();
foreach ($model as $item) {
var_dump($item->getData());
}
But it doesn't work ...
$model = Mage::getModel('log/customer');
var_dump(get_class_methods($model));
.... gives valid output like ...
array (size=54)
...
7 => string 'getCollection' (length=13)
...
Okay so far, but doing ...
$model = Mage::getModel('log/customer')->getCollection();
var_dump(get_class_methods($model));
... just returns null
. Reason for this is, there is no Mage_Log_Model_Resource_Customer_Collection
.
Adding this file there ...
class Mage_Log_Model_Resource_Customer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
protected function _construct()
{
$this->_init('log/customer');
}
}
... gives access to this DB table.
Is there any reason for not adding "Resource Collection" classes for some models? Anything that could break Magento? Just forgot to add these files?