Saving translations for acl acos modifies lft and rght fields in acos table in cakephp 4.4

I added the TranslateBehavior in AcosTable class with the ShadowStrategy and created the acos_translations table, when I save the records in acos_translations table the lft and rght fields in acos table are modified with bizarre values and in acos_translations these two fields have also bizarre values, this is the code for translate action:

    public function translate()
    {
        $aco = $this->MyPermissions->Acos->newEmptyEntity();
		if ($this->request->is('post')) {
            $acos = $this->MyPermissions->Acos->newEntities($this->request->getData('_translations.es'));
			$guardar = false;
			foreach($acos as $key => $value){
				if(!empty($this->request->getData('_translations.es.'.$key.'.alias'))){
					$value->_locale = 'es';
					$guardar = $this->MyPermissions->Acos->save($value);
					if(!$guardar) break;
				}
            }
			if($guardar){
                $this->Flash->success(__('Los permisos han sido traducidos.'));

                return $this->redirect(['controller' => 'Users', 'action' => 'login']);
			}
			$this->Flash->error(__('Los permisos no pudieron ser traducidos. Por favor, intente nuevamente.'));
        }
		$parent_id = $this->MyPermissions->Acos->find('all')->select('Acos.id')->where(['alias in' => $this->translations]);
        $acos = $this->MyPermissions->Acos->find('all')->where(['or' => ['alias in' => $this->translations, 'parent_id in' => $parent_id, 'parent_id is' => null]]);
        $this->set(compact('aco', 'acos'));
    }

And this is the code for translate view:

<?php
/**
 * @var \App\View\AppView $this
 * @var \App\Model\Entity\MyPermission[]|\Cake\Collection\CollectionInterface $myPermissions
 */
?>
<div class="myPermissions translate content">
    <h3><?= __('Traducir permisos') ?></h3>
	<?= $this->Form->create($aco) ?>
	<div class="table-responsive">
		<table>
			<tr>
				<th><?= __('Padre') ?></th>
				<th><?= __('Alias') ?></th>
				<th><?= __('Izquierda') ?></th>
				<th><?= __('Derecha') ?></th>
				<th><?= __('Traducción') ?></th>
			</tr>
			<?php
				$i = 0;
				foreach ($acos as $value) :
			?>
			<tr>
				<td><?= h($value->parent_id) ?></td>
				<td><?= h($value->alias) ?></td>
				<td><?= h($value->lft) ?></td>
				<td><?= h($value->rght) ?></td>
				<td>
					<?= $this->Form->control('_translations.es.'.$i.'.alias', ['label' => false]) ?>
					<?= $this->Form->hidden('_translations.es.'.$i.'.id', ['value' => $value->id]) ?>
					<?= $this->Form->hidden('_translations.es.'.$i.'.parent_id', ['value' => $value->parent_id]) ?>
					<?= $this->Form->hidden('_translations.es.'.$i.'.model', ['value' => $value->model]) ?>
					<?= $this->Form->hidden('_translations.es.'.$i.'.foreign_key', ['value' => $value->foreign_key]) ?>
					<?= $this->Form->hidden('_translations.es.'.$i.'.lft', ['value' => $value->lft]) ?>
					<?= $this->Form->hidden('_translations.es.'.$i.'.rght', ['value' => $value->rght]) ?>
				</td>
			</tr>
			<?php
					$i++;
				endforeach;
			?>
		</table>
	</div>
	<?= $this->Form->button('Guardar') ?>
	<?= $this->Form->end() ?>
</div>

How can I avoid the modification of acos table and saving the correct lft and rght values in acos_translations?

Basically what I want to know is how to save only the translation table and not the original table, is a question about TranslateBehavior.

Just create a form that directly addresses records in the translation table?

As you can see in the code of the view the form controls are created with _translations.es but in the controller action it saves the translation records with wrong lft and rght values and modifies these two fields in acos table, I need a little more help

I found out that in $this->addBehavior('Tree', ['type' => 'nested']); I can add $this->addBehavior('Tree', ['type' => 'nested', 'left' => 'Acos.lft', 'right' => 'Acos.rght']); but is still trying to modify the fields lft and rght, what array attribute should I put in the addBehavior Tree to avoid the modification of these fields?

Can you please help me with this? I need to solve this issue as soon as possible and don’t know how to do it.

What I need to do in the TreeBehavior class is execute the stopPropagation method in beforeSave method so that it doesn’t modify the Acos.lft and Acos.rght fields, how can I do that without altering the code in TreeBehavior class?

Create your own behavior which extends the TreeBehavior class and overwrite that method with your logic

Thank you @KevinPfeifer that worked perfect