Hi again,
I added two method to my extended Solar_Sql_Model/Solar_Sql_Model_Record classes that I think are very useful. With them, you can change a model parameter externally. Sometimes it is necessary to change the model relations (paging, order, where, etc) depending on the context, and currently only 'page' can be changed.
Here they are:
Solar_Sql_Model
<?php
public function setRelatedParam($name, $param, $value)
{
if (empty($this->_related[$name])) {
return false;
}
$this->_related[$name][$param] = $value;
}
Solar_Sql_Model_Record
<?php
public function setRelatedParam($name, $param, $value)
{
$this->_checkDeleted();
$this->_model->setRelatedParam($name, $param, $value);
}
Then, the current Solar_Sql_Model_Record::setRelatedPage() could use be just a wrapper for the method above, instead of doing the checkings itself:
<?php
public function setRelatedPage($name, $page)
{
$this->setRelatedParam($name, 'page', $value);
}
I hope this makes sense; let me know if you would like to know some use cases.