Skip to content

Conversation

@arlen
Copy link
Contributor

@arlen arlen commented Mar 11, 2026

This PR adds the EIS badges to the Person Canvas MVEAs when they exist. With the addition of the extra field, it became apparent that the data on the MVEAs needed better structure. This PR addresses that as well by converting the MVEA layouts into tables.

image

Comment on lines 98 to 116
$eisLookupTable = $extIdentities
->find('list', [
'keyField' => 'id',
'valueField' => 'description',
])
->select([
'id' => 'ExternalIdentities.id',
'description' => 'ExternalIdentitySources.description',
])
->innerJoinWith('ExtIdentitySourceRecords.ExternalIdentitySources')
->where([
'ExternalIdentities.person_id' => $personId,
])
->enableHydration(false)
->toArray();

$this->set('vv_external_identity_sources', $eisLookupTable);
}
Copy link
Contributor

@benno benno Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get nervous when joins are used, since we've historically had problems with joins not working correctly with ChangelogBehavior. This is also a very "SQL" way of looking at data. A more Cake-centric approach would be something like (I didn't test this exact syntax, in particular the combine path notation may need some debugging)

// Pull External Identities with External Identity Source information as associated records
$records = $extIdentities->find()->where(['person_id' => $personId])->contain(['ExtIdentitySourceRecords' => 'ExternalIdentitySources'])->all();

// Use Hash to pull a mapping of the record ID to the EIS description
$mapping = $records->combine('id', 'ext_identity_source_record.ext_identity_source.description')->toArray();

Comment on lines +99 to +113
// Pull External Identities with External Identity Source information as associated records
$records = $extIdentities
->find()
->where(['ExternalIdentities.person_id' => $personId])
->contain(['ExtIdentitySourceRecords' => ['ExternalIdentitySources']])
->all();

// Combine into a flat record id => EIS description lookup array
$eisLookupTable = (new \Cake\Collection\Collection($records))
->filter(function ($record) {
// Only include rows that actually have an EIS description
return !empty($record->ext_identity_source_record->external_identity_source->description);
})
->combine('id', 'ext_identity_source_record.external_identity_source.description')
->toArray();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The eisLookupTable is now built using standard cakephp approaches. The filter() allows us to only return rows with EISes, allowing the returned array to be identical to the original join approach.

@arlen arlen force-pushed the feature-cfm417-eisPersonCanvas branch from c7992d8 to aeef1d5 Compare March 31, 2026 18:15
@arlen
Copy link
Contributor Author

arlen commented Mar 31, 2026

Rebased against the latest develop

@benno benno requested a review from Ioannis May 5, 2026 16:02
@arlen arlen merged commit ff52258 into COmanage:develop May 6, 2026
@arlen arlen deleted the feature-cfm417-eisPersonCanvas branch May 6, 2026 18:19
Sign in to join this conversation on GitHub.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants