$this->StatesxDays->newEntities doesn't have the request data in cakephp 4.4

Thank you zuluru, now the request data adds the statesxDays entity in users entity, is saving correctly the statesxDays entities but it doesn’t add the doctor entities, and besides I have to modify various records in users entity, how do I have to do to solve this issue?
This is what is showing debug($doctors):

APP/Controller/StatesxDaysController.php (line 54)
object(App\Model\Entity\User) id:0 {
  'statesx_days' => [
    (int) 0 => object(App\Model\Entity\StatesxDay) id:1 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => ''
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:2 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 4
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
    (int) 1 => object(App\Model\Entity\StatesxDay) id:3 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => 'A'
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:4 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 5
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
    (int) 2 => object(App\Model\Entity\StatesxDay) id:5 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => 'B'
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:6 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 6
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
    (int) 3 => object(App\Model\Entity\StatesxDay) id:7 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => 'A'
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:8 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 7
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
    (int) 4 => object(App\Model\Entity\StatesxDay) id:9 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => 'B'
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:10 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 8
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
    (int) 5 => object(App\Model\Entity\StatesxDay) id:11 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => 'A'
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:12 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 9
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
    (int) 6 => object(App\Model\Entity\StatesxDay) id:13 {
      'group_id' => (int) 1
      'net_id' => (int) 1
      'main_gate' => 'B'
      'status' => (int) 4
      'date' => object(Cake\I18n\FrozenDate) id:14 {
        'time' => '2023-04-09 00:00:00.000000-03:00'
        'timezone' => 'America/Argentina/Cordoba'
        'fixedNowTime' => false
      }
      'hour' => '18:10:18'
      'user_id' => (int) 4
      'doctor_id' => (int) 10
      '[new]' => true
      '[accessible]' => [
        'user_id' => true,
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'pacient_id' => true,
        'doctor_id' => true,
        'date' => true,
        'hour' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'user' => true,
        'doctor' => true,
        'group' => true,
        'net' => true,
        'pacient' => true,
      ]
      '[dirty]' => [
        'group_id' => true,
        'net_id' => true,
        'main_gate' => true,
        'status' => true,
        'date' => true,
        'hour' => true,
        'user_id' => true,
        'doctor_id' => true,
      ]
      '[original]' => [
      ]
      '[virtual]' => [
      ]
      '[hasErrors]' => false
      '[errors]' => [
      ]
      '[invalid]' => [
      ]
      '[repository]' => 'StatesxDays'
    },
  ]
  '[new]' => true
  '[accessible]' => [
    'username' => true,
    'password' => true,
    'email' => true,
    'firstname' => true,
    'lastname' => true,
    'created' => true,
    'modified' => true,
    'profile_id' => true,
    'referrer_id' => true,
    'active' => true,
    'image_file_name_url' => true,
    'image_file_name' => true,
    'image_file_name_filename' => true,
    'map_lat' => true,
    'map_long' => true,
    'code' => true,
    'status' => true,
    'isolated' => true,
    'token' => true,
    'aro' => true,
    'profile' => true,
    'referrer' => true,
    'statesx_days' => true,
    'doctors' => true,
    'events_users' => true,
    'observations' => true,
    'pacients' => true,
    'status_groups' => true,
    'stocks_users' => true,
    'turns' => true,
    'doctorT' => true,
    'groups' => true,
  ]
  '[dirty]' => [
    'statesx_days' => true,
  ]
  '[original]' => [
  ]
  '[virtual]' => [
  ]
  '[hasErrors]' => false
  '[errors]' => [
  ]
  '[invalid]' => [
  ]
  '[repository]' => 'Doctor'
}

Is it expected that $doctors (which is a weird name for a single doctor, BTW…) should be a “User” entity?

Yes, because the statesxDays entity has an association with Users entity with two fields: user_id and doctor_id, with doctor_id I have to create another association named Doctor with className Users

So what you really want here is a User with a number of StatesxDays records, each of which in turn has a Doctor record (which is actually a User entity)?

Let me explain you, in user_id of statesxDays entity I save the logged in user, and in doctor_id I save the user id that is read from the users table using a filter by net_id field to show the matching records, I have seven users that match with net_id field in the users table, and what I need is to modify the status and isolated fields of this seven users

This would have been good to explain about 20 posts ago… This is nothing like what I was expecting when responding before.

Yes, sorry for that, I didn’t know what to explain

Can you help me please? I don’t know how to solve this issue

Please help me with this issue, I am stuck and don’t want to loose a good deal

Can anyone please help me with this issue? I don’t know how to do it and need to do it very soon

Please help me with this issue, I don’t know how to solve it, I created a public repo in github in this url: https://github.com/mdeanquin0520/public_repo.git for you to prove what’s wrong, in db folder is the file estadoatulado.sql that has the structure and the data of all the tables involved in the operation, the user to login is alejandro.ambrosini@unc.edu.ar and the password is lytfvn24108508, you have to click on “Estados de alerta” link in menu “Gestión de personal y pacientes”, in the index page try both buttons that are at the top of the page.
Thank you very much for the help.

I could save the records in StatesxDays table but is adding new records in Users table, how do I have to create the form controls in the view and the newEntities method in the controller to only modify existing records in Users table?
This is the code of the controller action:

    public function addUser() {
		$statesxDay = $this->StatesxDays->newEmptyEntity();
        if ($this->request->is('post')) {
			$guardar = false;
			$statesxDays = $this->StatesxDays->newEntities($this->request->getData(), ['associated' => ['Users' => ['onlyIds' => true]]]);
			foreach($statesxDays as $data){
				$guardar = $this->StatesxDays->save($data);
			}
			if($guardar){
				$this->Flash->success(__('Se modificaron los estados de los usuarios.'));
				return $this->redirect(['action' => 'index']);
			}
			$this->Flash->error(__('No se pudieron modificar los estados de los usuarios'));
		}
		$users = $this->StatesxDays->Users->find('all')->leftJoinWith('Groups')->where(['GroupsUsers.net_id' => $this->controllerUser['net_id']])
			->contain(['Groups' => ['Nets'], 'Profiles']);
		$this->set(compact('statesxDay', 'users'));
	}

And this is the code of the view:

<?php
/**
 * @var \App\View\AppView $this
 * @var iterable<\App\Model\Entity\StatesxDays> $StatesxDays
 */
?>
<div class="StatesxDays add_user content">
	<?php
		echo $this->Form->create($statesxDay);
		echo $this->Form->control('estado',['label'=>'Estado','options'=>[1 => 'Alerta verde', 2 => 'Alerta amarillo', 3 => 'Alerta naranja', 4 => 'Alerta rojo'], 'id' => 'estadoId']);
		//echo '<div id="selectEVent" style="display:none;">'.$this->Form->control('sourcing_event_id',['label'=>'Tipo de evento','options'=>$sourcingEvents,'empty'=>'-- Seleccionar evento --']).'</div>';
		echo $this->Form->button('Quitar selección',['type' => 'button', 'id' => 'quitar', 'class' => 'button float-right']);
		echo $this->Form->button('Seleccionar todos',['type' => 'button', 'id' => 'seleccionar', 'class' => 'button float-right']);
	?>
    <h3><?= __('Cambiar estado de recursos humanos') ?></h3>
    <div class="table-responsive">
        <table>
            <thead>
                <tr>
					<th>Nivel</th>
					<th>Foto</th>
					<th>Email</th>
					<th>Nombre</th>
					<th>Apellido</th>
					<th>Rol</th>
					<th>Celula</th>
					<th>UF</th>
					<th>Nodo</th>
					<th>Estado</th>
					<th>Aislado</th>
				</tr>
			</thead>
			<tbody>
				<?php
					$j = 0;
					foreach ($users as $user):
						$color = '';
						switch ($user->profile_id) {
							case '2':
								$color = '#000000';
								break;
							case '3':
								$color = '#041d54';
								break;
							case '4':
								$color = '#540404';
								break;
							case '5':
								$color = '#6D147A';
								break;
							case '6':
								$color = '#CC7400';
								break;
							case '7':
								$color = '#2E2EBF';
								break;            
							default:
								$color = '#30773D';
								break;
						}
				?>
				<tr>
					<td>
						<?php
							echo $user->profile_id;
							$group = '';
							$net = '';
							$main_gate = '';
							if($user->profile_id >= 3):
								$group = $user->groups[0]->group_name;
								if(!empty($user->groups[0]->_joinData->net_id)){
									$i = $user->groups[0]->_joinData->net_id - 1;
									$net = $user->groups[0]->nets[$i]->net_name;
								}
								$main_gate = $user->groups[0]->_joinData->main_gate;
								echo $this->Form->hidden($j.'.StatesxDays.group_id',['value'=>$user->groups[0]->id]);
								echo $this->Form->hidden($j.'.StatesxDays.net_id',['value'=>$user->groups[0]->_joinData->net_id]);
								echo $this->Form->hidden($j.'.StatesxDays.main_gate',['value'=>$main_gate]);
							endif
						?>
					</td>
					<td><?= $this->Html->image($user->image_file_name_url, ['title' => $user->image_file_name_filename, 'class' => 'img-circle']) ?></td>
					<td><?= $user->email ?></td>
					<td><?= $user->firstname ?></td> 
					<td><?= $user->lastname ?></td> 
					<td style="background-color:<?= $color ?>;color:#fff"><?= $user->profile->name ?></td> 
					<td><?= h($group) ?></td> 
					<td><?= h($net) ?></td> 
					<td><?= (!empty($main_gate)) ? '#'.$main_gate : ' - ' ?></td> 
					<td>
						<?= $this->Form->control($j.'.StatesxDays.status',['label'=>false, 'options'=>[1 => 'Alerta verde', 2 => 'Alerta amarillo', 3 => 'Alerta naranja', 4 => 'Alerta rojo'], 'class'=>'status']) ?>
						<?= $this->Form->hidden($j.'.StatesxDays.date',['value'=>date('Y-m-d')]) ?>
						<?= $this->Form->hidden($j.'.StatesxDays.hour',['value'=>date('H:i:s')]) ?>
						<?= $this->Form->hidden($j.'.StatesxDays.user_id',['value'=>$user->id]) ?>
					</td>
					<td>
						<?= $this->Form->checkbox($j.'.user.isolated',['value'=>true,'hiddenField' => false, 'class' => 'isolated']) ?>
						<?= $this->Form->hidden($j.'.user.id',['value'=>$user->id]) ?>
					</td>
				</tr>
				<?php
						$j++;
					endforeach;
				?>
			</tbody>
		</table>
	</div>
	<?= $this->Form->button(__('Guardar')) ?>
	<?= $this->Form->end() ?>
</div>
<script>
$(function(){
	$('#estadoId').change(function(){
		status = $(this).val();
		$('.status').val(status);
		if(status=="1" || status=="3") $('#selectEVent').show();
		else $('#selectEVent').hide();
	})
})
$(function(){
	$('#seleccionar').click(function() {
		$('.isolated').prop('checked', true);
	});
});
$(function(){
	$('#quitar').click(function() {
		$('.isolated').prop('checked', false);
	});
});
$(function(){
    $(document).ready(function() {  
		$('.input_oculto').hide();
	});
});
</script>

Can you please help me with this issue? I need to solve it as soon as possible so that I can start to offer it to potential clients.