public function init() { switch (1) { case !$this->model instanceof RepliesModel && ($this->parentType == null || $this->parentId == null || $this->parentKey == null): $this->model = null; break; default: $this->model = $this->model instanceof RepliesModel ? $this->model : RepliesModel::findModel([$this->parentId, $this->parentType, $this->parentKey]); break; } parent::init(); }
public function init() { switch (1) { case !$this->model instanceof RepliesModel && ($this->parentType == null || $this->parentId == null || $this->parentKey == null): $this->model = null; break; default: $this->model = $this->model instanceof RepliesModel ? $this->model : RepliesModel::findModel([$this->parentId, $this->parentType, $this->parentKey]); break; } parent::init(); $this->uniqid = !$this->uniqid ? '-' . uniqid() : $this->uniqid; $this->options['id'] .= $this->uniqid; Asset::register($this->getView()); }
/** * Get the userID for the reply_to author_id */ public function replyToAuthorId() { switch (empty($this->reply_to)) { case false: $this->reply_to_author_id = Replies::find()->select([$this->author_idIdKey])->where([static::primaryKey()[0] => $this->reply_to])->one()->author_id; break; } }
public function replies() { return $this->getCachedRelation('id', \nitm\widgets\models\Replies::className(), [], true, 'replies'); }
/** * Return the reply author_id information * @param string $what The property to return */ public function getReplyTo() { return $this->hasOne(\nitm\widgets\models\Replies::className(), ['id' => 'reply_to'])->with('author'); }