Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 /**
  * 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;
     }
 }
Ejemplo n.º 4
0
 public function replies()
 {
     return $this->getCachedRelation('id', \nitm\widgets\models\Replies::className(), [], true, 'replies');
 }
Ejemplo n.º 5
0
 /**
  * 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');
 }