patchEntity does not patch data properly with association

I have following table I am using for a messages function:

CREATE TABLE `messages` (
  `id` int(11) NOT NULL PRIMARY AUTO_INCREMENT,
  `to_user` int(11) NOT NULL,
  `from_user` int(11) NOT NULL,
  `message` text,
  `seen` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

I want now to create a new message the standard cakephp-way:

$message = $this->Messages->newEmptyEntity();
$message = $this->Messages->patchEntity($message, $this->request->getData());
$this->Messages->save($message);

This is my data that needs to be saved:

[
	'to_user' => (int) 2,
	'message' => 'test',
	'from_user' => (int) 1,
	'seen' => false
]

But it only saves the fields message and seen, even if all fields are accessible. I debugged the patched entity and got following result:

object(App\Model\Entity\Message) {

	'message' => 'test',
	'seen' => false,
	'[new]' => true,
	'[accessible]' => [
		'to_user' => true,
		'from_user' => true,
		'message' => true,
		'seen' => true,
		'created' => true
	],
	'[dirty]' => [
		'message' => true,
		'seen' => true
	],
	'[original]' => [],
	'[virtual]' => [],
	'[hasErrors]' => false,
	'[errors]' => [],
	'[invalid]' => [],
	'[repository]' => 'Messages'

}

When I remove the belongsTo relation, it works:

$this->belongsTo('ToUser', [
    'foreignKey' => 'to_user',
    'className' => 'Users',
    'propertyName' => 'to_user'
]);
$this->belongsTo('FromUser', [
    'foreignKey' => 'from_user',
    'className' => 'Users',
    'propertyName' => 'from_user'
]);

Now I don’t know how to debug or fix this issue. Any ideas?

you have field the same name as association and cake doesnt understand which one you want to use, thats why there are https://book.cakephp.org/3/en/intro/conventions.html#database-conventions for naming

Thank you.

I changed the sql-table fields to from_user_id and to_user_id, edited the Model and the relations were fixed and saving new entries were possible.

Here is my new MessagesTable:

    $this->belongsTo('ToUsers', [
        'foreignKey' => 'to_user_id',
        'joinType' => 'INNER',
        'className' => 'Users',
        'propertyName' => 'from_user'
    ]);
    $this->belongsTo('FromUsers', [
        'foreignKey' => 'from_user_id',
        'joinType' => 'INNER',
        'className' => 'Users',
        'propertyName' => 'from_user'
    ]);