this variable is used elsewhere in the outer function, so it should not
be limited to the lambda function.
// TODO: Extract all of this to a class for clarity and
// organization's sake.
- // Get the oldest join date for the contact's memberships.
- $getDao = function () use ($objectRef) {
+ $contactId = $objectRef->contact_id;
- $contactId = $objectRef->contact_id;
+ $getDao = function () use ($contactId) {
+
+ // Get the oldest join date for the contact's memberships.
$dao = CRM_Core_DAO::executeQuery(
'SELECT join_date FROM civicrm_membership WHERE contact_id=%1 ORDER BY join_date ASC LIMIT 1',
array( 1 => array($contactId, 'Integer') )