title: Table "App\Model\Table\UsersTable" is not associated with "id" cakephp 3
body: <p>I'm getting this error 'Table "App\Model\Table\UsersTable" is not associated with "id" ', can anyone help how to solve it?</p>
  
  <p>Here is the code of my documents table:</p>
  
  <pre><code>class DocumentsTable extends Table
  {
      public function initialize(array $config)
      {
          parent::initialize($config);
          $this-&gt;belongsTo('Users');
          //$this-&gt;setForeignKey('user_id');
          $this-&gt;setTable('documents');
          $this-&gt;setDisplayField('name');
          $this-&gt;setPrimaryKey('id');
  
          $this-&gt;addBehavior('Timestamp');
      }
  }
  </code></pre>
  
  <p>and here is the code of users table:</p>
  
  <pre><code>class UsersTable extends Table
  {
      public function initialize(array $config)
      {
          parent::initialize($config);
          $this-&gt;hasMany('Documents');
          $this-&gt;setTable('users');
          $this-&gt;setDisplayField('id');
          $this-&gt;setPrimaryKey('id');
  
          $this-&gt;addBehavior('Timestamp');
      }
  }
  </code></pre>
  
  <p>and here is what the error looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/RtMnB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RtMnB.png" alt="enter image description here"></a></p>
  
  <p>EDIT: According to the url I'm trying to reach the academics controller, in which I'm loading the documents table.</p>
  
  <p>In calander.ctp, one of the functions of academics table, I use the following code:</p>
  
  <pre><code>use Cake\ORM\TableRegistry;
  $admin = TableRegistry::get('Users');
  $name = $admin-&gt;find()-&gt;select(['name'])-&gt;where([$admin-&gt;id =&gt; $doc['user_id']])-&gt;first();
  echo $name;
  </code></pre>