/**
  * init cache connection
  *
  * @param ICache $cache
  * @param AbstractDatabase $db
  */
 public function __construct(ICache $cache, AbstractDatabase $db = null)
 {
     $this->relation = new \SplFixedArray();
     $this->modelDataCache = [];
     $this->tableData = new MySQLTableData($db);
     $this->paramTransformer = new DynamicSQLParameter();
     parent::__construct($cache, $db);
 }
 /**
  * @param $keyValue
  * @param AbstractModel $model
  */
 public function setModelPrimaryKey($keyValue, AbstractModel $model)
 {
     if (!$keyValue) {
         return;
     }
     $modelCacheData = $this->queryBuilder->getModelDataCache();
     if (isset($modelCacheData[get_class($model)])) {
         foreach ($modelCacheData[get_class($model)]['tableData']->getPrimaryKey() as $primaryKey) {
             $setter = "set" . ucfirst($primaryKey);
             if (method_exists($model, $setter)) {
                 $model->{$setter}($keyValue);
             }
         }
     }
 }