Value entered in Form gets lost

Hallo, in a cakephp app version 3.7.9 I receive following error.
two parameter are passed to the form creating a new notice, user_id = owner and todo_id = parent-item.
The user_id is found in the datebase stored correct, the todo_id is not stored. The db shows a zero.
I have recognized the value is available in the form and processed correct. After submitting the form in beforeMarshall the value is found, but in beforeSave it is lost. Why???
What could cause this issue?
Regards Klaus

public function add()
{
$todosnote = $this->Todosnotes->newEntity();
$user = $this->request->params[‘pass’][1]; // value available
$todo = $this->request->params[‘pass’][0]; // value available

    if ($this->request->is('post')) {
        $todosnote = $this->Todosnotes->patchEntity($todosnote, $this->request->getData());
        Log::write('error','todo_id-add ' . $todosnote->todo_id);  // **value not available**
        Log::write('error','user_id-add ' . $todosnote->user_id);  // **value available**          

        if ($this->Todosnotes->save($todosnote)) {
            $this->Flash->success(__('The todosnote has been saved.'));
            return $this->redirect(['controller' => 'todos','action' => 'index']);
        }
        $this->Flash->error(__('The todosnote could not be saved. Please, try again.'));
    }

    $todos = $this->Todosnotes->Todos->find('list', ['limit' => 200]);
    $users = $this->Todosnotes->Users->find('list', ['limit' => 200]);
    $this->set(compact('todosnote', 'users'));
    $this->set('t_id', $todo);
    $this->set('u_id', $user);
    $this->set('todos', $todos);
}

========================================================
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) {
if (isset($data[‘todo_id’])) {
Log::write(‘error’,'todo_id-marshall: ’ . $data[‘todo_id’]); // value available
}
}

public function beforeSave( $event, $entity,  $options) {
    $entity = $event->getData('entity');  // value not available
   // dd($entity);
}
       

public function afterSave( $event, $entity,  $options) {
    $entity = $event->getData('entity');
    // dd($entity);
}

Is todo_item in your accessible list? Did you add it to your database recently and not clear the ORM cache since then?

Thank you it was “accessible”. Since today I was using the * but not in this case unfortunately. Regards Klaus