Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Nov 9, 2022
1 parent a1fa97a commit 83017a3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/controllers/TBackendModelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use skeeks\cms\backend\widgets\ControllerActionsWidget;
use skeeks\cms\helpers\RequestResponse;
use skeeks\cms\IHasName;
use skeeks\cms\models\CmsUser;
use yii\base\InvalidConfigException;
use yii\base\Model;
use yii\db\ActiveRecord;
Expand Down Expand Up @@ -255,10 +256,20 @@ public function getModel()

if ($pk) {
$modelClass = $this->modelClassName;
/**
* @var $newModel CmsUser
*/
$newModel = new $modelClass();

$this->_model = $modelClass::find()
->where([$this->modelPkAttribute => $pk])
->limit(1)->one();
$q = $modelClass::find()
->andWhere([$this->modelPkAttribute => $pk]);

if ($newModel->hasAttribute("cms_site_id")) {
$q->cmsSite();
}

$this->_model = $q->limit(1)
->one();
}
}

Expand Down

0 comments on commit 83017a3

Please sign in to comment.