Table "App\Model\Table\UsersTable" is not associated with "id" in cakephp3

Table “App\Model\Table\UsersTable” is not associated with “id” in cakephp3

If you want help:

  1. Ask a question
  2. Show what you tried
  3. Show your relevant code

i’m getting the same error, can you help?

this is my users table:
class UsersTable extends Table
{

public function initialize(array $config)
{
    parent::initialize($config);
    //$this->hasMany('documents');
    $this->setTable('users');
    $this->setDisplayField('id');
    $this->setPrimaryKey('id');

    $this->addBehavior('Timestamp');
}

}

and here is the documents table i’m trying users to associate with:
class DocumentsTable extends Table
{

public function initialize(array $config)
{
    parent::initialize($config);
    $this->belongsTo('Users');
    //$this->setForeignKey('admin_id');
    $this->setTable('documents');
    $this->setDisplayField('name');
    $this->setPrimaryKey('id');

    $this->addBehavior('Timestamp');
}

}

this is the error i’m getting:

How does your Users table structure looks like? Do you have an id field?

yes, I have ‘id’ in users table and ‘user_id’ in documents table.