CakePhp 3.6 issuing message deprecated (Accessing data as a property will be removed in 4.0.0.)

0

I have some code in Php using CakePhp 3.6 that is issuing the following alert:

Deprecated (16384): Accessing 'data' as a property will be removed in 4.0.0. Use request->getData() instead. - F:\php\frameworks\cakePhp\bookmarker\src\Controller\ContactController.php, line: 33 [CORE\src\Core\functions.php, line 305]

An example code would be as below:

$this->request->data['email'] = $user_data['email'];
What happens is that if it is a get I can solve it using getData('email') for example, but if it's a set I do not know how to do it, I tried something very strange like the following:

 $this->request->getData('email') = $user_data['email'];

I also tried:

$this->request->setData('email', $user_data['email']);

But it did not work.

    
asked by anonymous 01.05.2018 / 17:01

1 answer

0

I did a lot, but I found the answer.

You are at link

withData( string $name , mixed $value )

So it looks like this:

$this->request->withData('email', $user_data['email']);

It is used with ... to set values, I do not know why, I do not know if this is a convention.

    
01.05.2018 / 19:27