Here's my problem. I have a bunch of myisam lookup tables containing id and name, and Models in my project depend on the lookup tables to display name. Thanks to the belongsTo method, I can easly get the table by accessing $model->Aliasname->name;. But if it used to often it will continually fetch from database. Please help me to implement the method to cached the name. Here is my uncached helper method to retrieve the name
class ModelBase implements \Phalcon\Mvc\Model{
public function nameOf($model){
//TODO: implement a cache here
$x = $this->getRelated($model);
$name = $x ? $x->name : null;
return $name;
}
}