I have a relationship defined like this:

In an authorization, I want to relate a new service by clicking the + in the relationship panel:
The flyout appears and the link to the authorization is present as expected:
The request to the server includes the authorization ID as well:
However, the entity data in the hook does not have the authorization ID and the new service does not relate to the authorization:
The new service record exists, but it must be manually linked to the authorization using the select option in the relationship panel:

This issue does not occur with every relationship panel. I tried several others and they work as expected. I have not changed the clientDef or entityDef files for the Authorization or Service entities. Any ideas would be appreciated.
In an authorization, I want to relate a new service by clicking the + in the relationship panel:
The flyout appears and the link to the authorization is present as expected:
The request to the server includes the authorization ID as well:
Code:
{
"authorizationId":"625c8623ad61fa0c7",
"authorizationName":"Non-Billable",
"teamsIds":[
"619cdff8812c61705",
"60e77591063fffa91"
],
"teamsNames":{
"619cdff8812c61705":"Administrative",
"60e77591063fffa91":"Owners"
},
"unitsUsed":0,
"unitsRemaining":0,
"daysTotal":0,
"daysTranspired":0,
"daysRemaining":0,
"unitsProjectedBalance":0,
"name":"Direct Therapy",
"cPTCodesIds":[
"6245811185913e578"
],
"cPTCodesNames":{
"6245811185913e578":"97151"
},
"description":null,
"unitsMaxPerWeek":null,
"unitsMaxPerMonth":null,
"unitsApproved":5,
"assignedUserName":null,
"assignedUserId":null
}
However, the entity data in the hook does not have the authorization ID and the new service does not relate to the authorization:
PHP Code:
public function afterSave(Entity $service, array $options = array()) {
$GLOBALS["log"]->debug("afterSave",[$service->toArray()]);
$this->calculateMetrics($service);
}
public function beforeSave(Entity $service, array $options = array()) {
$GLOBALS["log"]->debug("beforeSave",[$service->toArray()]);
}
public function beforeRelate(Entity $service, array $options = array()) {
$GLOBALS["log"]->debug("beforeRelate",[$service->toArray()]);
}
public function afterRelate(Entity $service, array $options = array()) {
$GLOBALS["log"]->debug("afterRelate",[$service->toArray()]);
}
Code:
[2022-09-23 15:41:34] DEBUG: beforeSave [{"id":"632dd3ae79952e303","name":"Direct Therapy","deleted":false,"description":null,"createdAt":"2022-09-23 15:41:34","modifiedAt":"2022-09-23 15:41:34","unitsApproved":5,"unitsUsed":0,"unitsRemaining":0,"unitsMaxPerWeek":null,"daysTotal":0,"daysTranspired":0,"daysRemaining":0,"unitsProjectedBalance":0,"unitsMaxPerMonth":null,"createdById":"60e77309b0a75b5b2","assignedUserId":null,"assignedUserName":null,"teamsIds":["60e77591063fffa91"],"teamsNames":{"stdClass":{"60e77591063fffa91":"Owners"}},"cPTCodesIds":["6245811185913e578"],"cPTCodesNames":{"stdClass":{"6245811185913e578":"97151"}}}] []
[2022-09-23 15:41:34] DEBUG: afterRelate [{"id":"632dd3ae79952e303","name":"Direct Therapy","deleted":false,"description":null,"createdAt":"2022-09-23 15:41:34","modifiedAt":"2022-09-23 15:41:34","unitsApproved":5,"unitsUsed":0,"unitsRemaining":0,"unitsMaxPerWeek":null,"daysTotal":0,"daysTranspired":0,"daysRemaining":0,"unitsProjectedBalance":0,"unitsMaxPerMonth":null,"createdById":"60e77309b0a75b5b2","assignedUserId":null,"assignedUserName":null,"teamsIds":["60e77591063fffa91"],"teamsNames":{"stdClass":{"60e77591063fffa91":"Owners"}},"cPTCodesIds":["6245811185913e578"],"cPTCodesNames":{"stdClass":{"6245811185913e578":"97151"}}}] []
[2022-09-23 15:41:34] DEBUG: afterRelate [{"id":"632dd3ae79952e303","name":"Direct Therapy","deleted":false,"description":null,"createdAt":"2022-09-23 15:41:34","modifiedAt":"2022-09-23 15:41:34","unitsApproved":5,"unitsUsed":0,"unitsRemaining":0,"unitsMaxPerWeek":null,"daysTotal":0,"daysTranspired":0,"daysRemaining":0,"unitsProjectedBalance":0,"unitsMaxPerMonth":null,"createdById":"60e77309b0a75b5b2","assignedUserId":null,"assignedUserName":null,"teamsIds":["60e77591063fffa91"],"teamsNames":{"stdClass":{"60e77591063fffa91":"Owners"}},"cPTCodesIds":["6245811185913e578"],"cPTCodesNames":{"stdClass":{"6245811185913e578":"97151"}}}] []
[2022-09-23 15:41:34] DEBUG: afterSave [{"id":"632dd3ae79952e303","name":"Direct Therapy","deleted":false,"description":null,"createdAt":"2022-09-23 15:41:34","modifiedAt":"2022-09-23 15:41:34","unitsApproved":5,"unitsUsed":0,"unitsRemaining":0,"unitsMaxPerWeek":null,"daysTotal":0,"daysTranspired":0,"daysRemaining":0,"unitsProjectedBalance":0,"unitsMaxPerMonth":null,"createdById":"60e77309b0a75b5b2","assignedUserId":null,"assignedUserName":null,"teamsIds":["60e77591063fffa91"],"teamsNames":{"stdClass":{"60e77591063fffa91":"Owners"}},"cPTCodesIds":["6245811185913e578"],"cPTCodesNames":{"stdClass":{"6245811185913e578":"97151"}}}] []
The new service record exists, but it must be manually linked to the authorization using the select option in the relationship panel:
This issue does not occur with every relationship panel. I tried several others and they work as expected. I have not changed the clientDef or entityDef files for the Authorization or Service entities. Any ideas would be appreciated.

Comment