I’m trying to set some data on an entity in my controller, and it works for some fields, but not others.
Example
$schedule = $this->Schedules->newEntity();
$schedule->set('user_id', $this->Auth->user('id'));
$schedule->set('type', $type);
Debug tells me that this looks appropriate.
2016-11-04 23:18:34 Debug: {
"user_id": 36,
"type": "pend"
}
However, after I serialize it with the request data, “user_id” is null.
2016-11-04 23:23:54 Debug: {
"user_id": null,
"type": "pend",
"id": "1478300204161",
"job_id": 0,
"venue_id": 1,
"start_date": "2017-02-20 17:45-0800",
"end_date": "2017-02-20 22:45-0800"
}
Because user_id is a field in the request, I’m assuming that the serialization process is confused about finding that field in an entity as well as in the request data. Is there a way to tell Cake which one to use?