I'm looking at porting over some functions from the CakePHP 2.0 Users plugin into CakePHP 3.0. I've encountered this line in the old code:
$user = $this->{$this->modelClass}->passwordReset($this->request->data);
I debugged $user here and got a huge object filled with all kinds of data that I need. Perfect:
'properties' => [
'password' => '*****',
'id' => '53f7b636-e558-4eef-9064-1e78494ef653',
'username' => 'blahblah',
...
]
I thought everything was working perfectly until the next line:
$Email->to($user[$this->modelClass]['email'])
This is the first line of an email about to send. Here, $user[$this->modelClass]['email'] returns null. So I tried accessing the object directly, like so:
debug($user['properties']['email'])
This still returns null, I'm assuming because I'm trying to access parameters from a model. I'm not exactly sure what is different in CakePHP 3.0 for $this->modelClass or if I goofed up elsewhere. Any ideas?
$user->email. See also Cookbook > Entities > Accessing Entity Data - ndm