[Solar-talk] How can i implement ordering on a
_belongsToor_hasMany relationship
Rodrigo Moraes
rodrigo.moraes at gmail.com
Wed Feb 20 10:06:58 CST 2008
i'm probably missing something, but here's simple way to set a related
property dynamically:
$model->getRelated('related_name')->where = array(...);
$model->getRelated('related_name')->paging = 10;
$model->getRelated('related_name')->order = 'name';
... etc
...or in a method:
/**
*
* Sets a relationship parameter.
*
* @param string $name The relationship name.
*
* @param string $param The relationship parameter.
*
* @param mixed $value The parameter value.
*
*/
public function setRelatedParam($name, $param, $value)
{
$related = $this->getRelated($name);
$related->$param = $value;
}
no?
i'm not sure if it would work. i had a method like this before the new
model (there's also a ticket on trac). for some reason i never
implemented it in the new model.
-- rodrigo
More information about the Solar-talk
mailing list