Example #1
0
 /**
  * @param Model $model
  */
 public function setModelData($model)
 {
     $data = $model->getExtendedData();
     $tableName = $model->getTableName();
     $id = Util::lavnn('id', $data, 0);
     if ($id > 0) {
         // save the value in cache
         $key = 'models/' . $tableName . '/' . $id;
         $this->set($key, json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
         // also save in memory
         $this->models[$tableName][$id] = $data;
     }
 }