title: What is causing the error "Cannot declare class className because the name is already in use"
body: <p>I cannot find the cause of this error.</p>
  
  <p>I have a model (school profile) that has a relation to another model (fields of study).</p>
  
  <p>When I try to access the related model I get the error "Cannot declare class app\models\FieldOfStudy because the name is already in use"</p>
  
  <p>I am not aware of using it anywhere else.</p>
  
  <p>Relation code:</p>
  
  <pre><code>public function getFieldsOfStudy()
  {
      return $this-&gt;hasMany(FieldOfStudy::className(), ['fieldOfStudyId' =&gt; 'fieldOfStudyId'])
          -&gt;viaTable('schoolProfileFieldOfStudyXref', ['schoolProfileId' =&gt; 'schoolProfileId']);
  }
  </code></pre>
  
  <p>I am trying to access the related model like so:</p>
  
  <pre><code>$schoolProfile-&gt;fieldsOfStudy;
  </code></pre>
  
  <p>The thing that is particularly frustrating is that I use these same classes in another project. I have never seen this error. The error output indicates that the error is happening in the above hasMany function when it simply tries to load the class.</p>
  
  <p>Any ideas?</p>