/** * @return Address - associated with parent having type set to residential */ public function getFiles() { return $this->hasmany(CmgFile::className(), ['id' => 'fileId'])->viaTable(CoreTables::TABLE_MODEL_FILE, ['parentId' => 'id'], function ($query) { $modelFile = CoreTables::TABLE_MODEL_FILE; $query->onCondition("{$modelFile}.parentType=:type", [':type' => $this->fileType]); }); }
/** * @return CmgFile - associated file */ public function getFile() { return $this->hasOne(CmgFile::className(), ['id' => 'fileId']); }
public function getVideo() { return $this->hasOne(CmgFile::className(), ['id' => 'videoId']); }
/** * @return File - file url */ public function getBanner() { return $this->hasOne(CmgFile::className(), ['id' => 'bannerId']); }
/** * @return File - file url */ public function getAvatar() { return $this->hasOne(CmgFile::className(), ['id' => 'avatarId']); }