getRequest in component cakeph 3.8

Hello

I’ve upgraded from 3.4 to 3.8 - yeah I know it’s a little late :slight_smile:

I have a component which is handling setting session variables amongst other things. Previously it have lines like:

$this->request->session()->write(‘Config.settingId’, $settings_array->id);

After the upgrade to 3.8 this is failing - due to I believe $this->reesut becoming $this->getRequest

So i’ve changed it to:

$session = $this->getRequest()->getSession();
$session->write(‘Config.settingId’, $settings_array->id);

As in the documentation however it then fail with;

Call to undefined method App\Controller\Component\MyComponent::getRequest()

Any Ideas please and how I resolve this?

The request is still on the controller so

//$this is your Component
$this->getController()->getRequest()->getSession();