title: Yii2 viaTable many-to-many. Tables has no relation. Eagre loading
body: <p>There is 2 tables many-to-manty and another Intermediary able</p>
  
  <pre><code>$this-&gt;createTable('tweet',[
      'id' =&gt; Schema::TYPE_PK,
      'text' =&gt; Schema::TYPE_STRING.' NOT NULL',
      'date_written' =&gt; Schema::TYPE_STRING.' NOT NULL',
      'date_imported' =&gt; Schema::TYPE_STRING.' NOT NULL',
  ],"ENGINE=InnoDB DEFAULT CHARSET=utf8");
  $this-&gt;createTable('hashtag',[
      'text' =&gt; $this-&gt;string(),
      'PRIMARY KEY(text)'
  ],"ENGINE=InnoDB DEFAULT CHARSET=utf8");
  $this-&gt;createTable('tweet_hashtag', [
      'tweet_id' =&gt; $this-&gt;integer(),
      'hashtag_text' =&gt; $this-&gt;string(),
      'PRIMARY KEY(tweet_id, hashtag_text)'
  ],"ENGINE=InnoDB DEFAULT CHARSET=utf8");
  
  $this-&gt;createIndex('idx-tweet_hashtag-tweet_id', 'tweet_hashtag', 'tweet_id');
  $this-&gt;createIndex('idx-tweet_hashtag-hashtag_text', 'tweet_hashtag', 'hashtag_text');
  
  $this-&gt;addForeignKey('fk-tweet_hashtag-tweet_id', 'tweet_hashtag', 'tweet_id', 'tweet', 'id', 'CASCADE');
  $this-&gt;addForeignKey('fk-tweet_hashtag-hashtag_text', 'tweet_hashtag', 'hashtag_text', 'hashtag', 'text', 'CASCADE');
  </code></pre>
  
  <p>Table Tweet</p>
  
  <pre><code>public function getTweetHashtags()
  {
      return $this-&gt;hasMany(TweetHashtag::className(), ['tweet_id' =&gt; 'id']);
  }
  public function getHashtagTexts()
  {
      return $this-&gt;hasMany(Hashtag::className(), ['text' =&gt; 'hashtag_text'])-&gt;viaTable('tweet_hashtag', ['tweet_id' =&gt; 'id']);
  }
  </code></pre>
  
  <p>Table tweet_hashtag</p>
  
  <pre><code>   public function getHashtagText()
      {
          return $this-&gt;hasOne(Hashtag::className(), ['text' =&gt; 'hashtag_text']);
      }
      public function getTweet()
      {
          return $this-&gt;hasOne(Tweet::className(), ['id' =&gt; 'tweet_id']);
      }
  </code></pre>
  
  <p>Table hashtag</p>
  
  <pre><code>    public function getTweetHashtags()
      {
          return $this-&gt;hasMany(TweetHashtag::className(), ['hashtag_text' =&gt; 'text']);
      }
  
      public function getTweets()
      {
          return $this-&gt;hasMany(Tweet::className(), ['id' =&gt; 'tweet_id'])-&gt;viaTable('tweet_hashtag', ['hashtag_text' =&gt; 'text']);
      }
  </code></pre>
  
  <p>When i try 
  <code>Tweet::find()-&gt;with('hashtag')-&gt;where(['id' =&gt; $tweetID])-&gt;all()</code>
  there is Exception</p>
  
  <pre><code>Exception 'yii\base\InvalidParamException' with message 'app\models\Tweet has no relation named "hashtag".'
  </code></pre>
  
  <p>How I can correctly made eagre loading. To get 'text' from hashtag table, by id in Tweet table.</p>