Hi, I realised that after doing a query with CakePHP (3.x) you get the specified data, but also some kind of query results. The following controller code…
$userQuery = $this->Users->find('all')
->where(['username' => 'tester']);
$userR = $userQuery->first();
debug($userR);
…Outputs the following:
object(App\Model\Entity\User) {
'id' => (int) 2,
'username' => 'tester',
'password' => '$2y$10$.yhyhz9uoLhUk8eQbEYb0Okk33z42kBztsk7iuYj5nvbwctUbOE7S',
'role' => 'user',
'name' => 'Test Account',
'approved' => false,
'created' => object(Cake\I18n\FrozenDate) {
'time' => '2016-07-03T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'modified' => object(Cake\I18n\FrozenDate) {
'time' => '2016-07-03T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'[new]' => false,
'[accessible]' => [
'*' => true
],
'[dirty]' => [],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Users'
}
The last eight entries have keys with brackets and are not in the model.
Where did these entries come from? Is there a way of avoiding or purging them?
Thanks in advance!