Hi All,
I am trying to reason about getting a record from the DB using beans without overfetching.
I have built an entryPoint for a separate web application to use to mark attendance of an event.
there are 3 modules at play
FP_events
Contacts
Attendance (custom module)
the relationship between each are as follows
Contacts : Attendance = one-to-many
Events : Contacts = many-to-many
Events: Attendance = many-to-many
I wish to fetch a single attendance via the event bean which is also linked to a known contact at run-time (or to create one if one isn’t found but that is outside of the scope of this question). I am unsure how to filter on the table which isn’t part of the relationship used in get_linked_beans
I have tried something like the following but to no avail
$event = BeanFactory::getBean('FP_events', $_POST['eventID']);
$contact = BeanFactory::getBean('Contacts')->retrieve_by_string_fields(['***' => $_POST['***']]);
$attendance = reset($event->get_linked_beans(
'fp_events_attendance_1',
'Attendance',
[],
0,
1,
0,
"contacts_attendance_1_c.contacts_attendance_1contacts_ida = '{$contact->id}'"
));