コード例 #1
0
ファイル: FileTrait.php プロジェクト: cmsgears/module-core
 /**
  * @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]);
     });
 }
コード例 #2
0
ファイル: ModelFile.php プロジェクト: cmsgears/module-core
 /**
  * @return CmgFile - associated file
  */
 public function getFile()
 {
     return $this->hasOne(CmgFile::className(), ['id' => 'fileId']);
 }
コード例 #3
0
ファイル: Block.php プロジェクト: cmsgears/module-cms
 public function getVideo()
 {
     return $this->hasOne(CmgFile::className(), ['id' => 'videoId']);
 }
コード例 #4
0
ファイル: Site.php プロジェクト: cmsgears/module-core
 /**
  * @return File - file url
  */
 public function getBanner()
 {
     return $this->hasOne(CmgFile::className(), ['id' => 'bannerId']);
 }
コード例 #5
0
ファイル: Category.php プロジェクト: cmsgears/module-core
 /**
  * @return File - file url
  */
 public function getAvatar()
 {
     return $this->hasOne(CmgFile::className(), ['id' => 'avatarId']);
 }