Hello.
I have a minor problem.
One model has a relation with another of HAS_MANY type.
public function relations()
{
return array(
'cache' => array(SELF::HAS_MANY, 'Cache', 'id'),
);
}
Second model is just a list of name-value pairs:
CREATE TABLE `Cache` (
`id` bigint unsigned,
`name` varchar(250),
`value` double unsigned,
unique(`id`,`name`)
) engine = MyISAM;
Currently $model->cache is an array of Cache models.
What I want is to access ‘value’ of Cache model by it’s ‘name’.
For ex. Cache has a row with name=myvar and value=myval
and I want to use $model->cache->myvar so it returns ‘myval’.
Is this possible?
Thank you.