diff --git a/Module.php b/Module.php
index 7bd388d..bbb3c68 100755
--- a/Module.php
+++ b/Module.php
@@ -79,7 +79,8 @@ public function getModelSubDir($model)
     {
      
         $modelName = $this->getShortClass($model);
-        $modelDir = \yii\helpers\Inflector::pluralize($modelName).'/'. $modelName . $model->id;
+        $tbl_primaryKey = $model->getTableSchema()->primaryKey[0];
+        $modelDir = \yii\helpers\Inflector::pluralize($modelName).'/'. $modelName . $model->$tbl_primaryKey;
         return $modelDir;