enter image description here

Please tell me in View you need to display all the platforms that the game has, I first encountered the linking via the intermediate table for the first time so public function getPlatform(){ return $this->hasMany(Platform::className(), ['platform_id' => 'fk_platform_id']) ->viaTable('game_platform', ['fk_game_id' => 'id']); } public function getPlatform(){ return $this->hasMany(Platform::className(), ['platform_id' => 'fk_platform_id']) ->viaTable('game_platform', ['fk_game_id' => 'id']); } all in the GamePlatform model

  • What is the problem? - lyhoshva
  • the problem is that $ model-> platform-> name returns NULL - bOPT_MexaHuK
  • I do not see the problem in the code. mb data in the database are connected incorrectly? - lyhoshva
  • one
    все это в модели GamePlatform this method should be in Game - lyhoshva
  • Yes, thank you very much! - bOPT_MexaHuK

1 answer 1

all this in the GamePlatform model, this method should be in the Game