Cant detect checkboxes in a loop in cakephp4

In cakephp3.2 I used to display checkboxes like below in a form. Now in cakephp4 I can display the checboxes fine but when selecting a checkbox there is no output at all on any checkbox when i view the posted form data. Its as if the checkboxes didnt exist.

 foreach ($alldata as $key =>$item2): 
        //tried a few variants for checkbox
      //  echo '<td>'.$this->Form->control('Lesson'.$key.'.lcheck',  array('label'=>'','type'=>'checkbox', 'id'=> $stId,'checked'=>0));
          echo '<td>'.$this->Form->checkbox('Lesson'.$key.'.lcheck',  array('label'=>'', 'value'=>0));
          echo $this->Form->hidden('Lesson'.$key.'.id',  array( 'value'=> $stId));

  if ($this->request->is('post')) {
      debug( $this->request->getData());//no checkboxes appear like in cakephp3 so no checkbox selection is made

A checkbox value is only passed if checked.

I did a gist on checkboxes, not cake, but you should see how it works:

Adapt to cake request. I don’t know if cake has old data, but the array part is similar.