Antti mentioned this idea a while ago on IRC, and I agree it would be useful: Solar_Sql_Model_Record::getRelatedModel() would be a shortcut to get a related model from a record:
/**
*
* Returns the model from a relationship.
*
* @param string $name The relationship name.
*
*/
public function getRelatedModel($name)
{
return $this->_model->getRelated($name)->getModel();
}
A bit related to the above would be Solar_Sql_Model_Record::countPagesRelated(), a shortcut to count pages for related records:
/**
*
* Counts the number of records in a related model for this record.
*
* @param string $name The relationship name.
*
* @param array $params Parameters for the related SELECT; honors keys for
* 'where', 'having', 'group', and 'paging'.
*
* @return array An array with keys 'count' (the count of records) and
* 'pages' (the number of pages of records).
*
*/
public function countPagesRelated($name, $params = null)
{
return $this->_model->countPagesRelated($this, $name, $params);
}