/** * Related Content model * * @return \yii\db\ActiveQuery */ public function getContent() { return $this->hasOne(Content::className(), ['object_id' => 'id'])->andWhere(['content.object_model' => self::className()]); }
public function getContent() { return $this->hasOne(Content::className(), ['object_id' => 'object_id', 'object_model' => 'object_model']); }
public function getBaseContent() { $query = $this->hasOne(\humhub\modules\content\models\Content::className(), ['object_id' => 'id']); $query->andWhere(['file.object_model' => self::className()]); return $query; }
public function getContent() { return $this->hasOne(Content::className(), ['id' => 'content_id']); }
public static function getIdFromPath($path, $contentContainer, $separator = '/') { $titles = array_reverse(explode($separator, $path)); if (sizeof($titles) <= 0) { return null; } $folders = Folder::find()->contentContainer($contentContainer)->readable()->where(['title' => $titles[0]])->all(); if (sizeof($folders) <= 0) { return null; } unset($titles[0]); foreach ($titles as $index => $title) { if (sizeof($folders) <= 0) { return null; } } $query = $this->hasOne(\humhub\modules\content\models\Content::className(), ['object_id' => 'id']); $query->andWhere(['file.object_model' => self::className()]); }