From 67d9aaf1c0e4ec2e02a32413b3b278c02d355c25 Mon Sep 17 00:00:00 2001 From: Igor Chepurnoy Date: Fri, 6 Jan 2017 17:25:51 +0200 Subject: [PATCH] small fix --- widgets/Comment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widgets/Comment.php b/widgets/Comment.php index c1f1a16..21d2b17 100644 --- a/widgets/Comment.php +++ b/widgets/Comment.php @@ -110,13 +110,13 @@ public function init() $this->pjaxContainerId = 'comment-pjax-container-' . $this->getId(); } - $this->entity = hash('crc32', get_class($this->model)); - $this->entityId = $this->model->{$this->entityIdAttribute}; - - if (empty($this->entityId)) { + if (empty($this->model->{$this->entityIdAttribute})) { throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "entityIdAttribute" value for widget model cannot be empty.')); } + $this->entity = hash('crc32', get_class($this->model)); + $this->entityId = $this->model->{$this->entityIdAttribute}; + if (empty($this->relatedTo)) { $this->relatedTo = get_class($this->model) . ':' . $this->entityId; }