Im trying to detect a change in a relationship through a logic hook but I cant seem to get the old value to compare it to the new.
I have a serial number module which has a relationship to accounts
Accounts -> one-to-many -> S_SerialNumber
this is visible in my module view and i can get the relationship data if i query the S_SerialNumber
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"accounts_s_serialnumber_1_name": "ID Print",
"accounts_s_serialnumber_1": {
"name": "ID Print",
"id": "cac71e64-7c2c-11eb-9bf6-066c2def7d44",
"_acl": {
"fields": {
"business_center_name": {
"create": "no",
"write": "no",
"license": "no"
},
"business_center_id": {
"create": "no",
"write": "no",
"license": "no"
}
},
"_hash": "e376f7492abb281a71d6a0860441877a"
}
},
"accounts_s_serialnumber_1accounts_ida": "cac71e64-7c2c-11eb-9bf6-066c2def7d44",
the problem I'm having is I want to detect if this relationship is changed on an after_save logic hook
My before_save hook captures the data with the
Fullscreen
1
2
3
4
public function get_record($bean, $event, $arguments)
{
$bean->stored_fetched_row_c = $bean->fetched_row;
}
However $bean->fetched_row does not include the relationship data for me to then compare
If I use the $bean->load_relationship() it only gets the updated data
Anybody know how you compare a relationship between a before and after save logic hook?