Skip to content

Commit

Permalink
ORM deprecation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Sep 12, 2025
1 parent 18264dc commit 4f22a75
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
if(!empty($vv_obj->api_source_id)) {
$apiSource = $this->ApiSourceEndpoints->ApiSources->get(
$vv_obj->api_source_id,
['contain' => 'ExternalIdentitySources']
contain: 'ExternalIdentitySources'
);

$this->set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ protected function mapApiToRegistry(string $model, array $attributes): array {
*/

public function remove(int $id, string $sorLabel, string $sorId): bool {
// We call this remove() so as not to interfere with the default table::delete().
$apiSource = $this->get($id, ['contain' => ['ExternalIdentitySources']]);

// Pull our configuration
$apiSource = $this->get($id, ['contain' => ['ExternalIdentitySources']]);
$apiSource = $this->get($id, contain: ['ExternalIdentitySources']);

// Like upsert(), we don't really need $sorLabel, but we check it for
// consistency with upsert() (which also doesn't really need it).
Expand Down Expand Up @@ -413,7 +410,7 @@ public function upsert(
$ret = [];

// Pull our configuration
$apiSource = $this->get($id, ['contain' => ['ExternalIdentitySources']]);
$apiSource = $this->get($id, contain: ['ExternalIdentitySources']);

// Strictly speaking we don't need $sorLabel since we know which configuration
// to use from the ApiSource ID, and $sorLabel might not be unique across COs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ protected function syncEntity(
*/

public function syncReferenceData(int $id, string $dataSource='targetdb') {
$spcfg = $this->get($id, ['contain' => ['ProvisioningTargets']]);
$spcfg = $this->get($id, contain: ['ProvisioningTargets']);

$this->Servers->SqlServers->connect($spcfg->server_id, $dataSource);

Expand Down
2 changes: 1 addition & 1 deletion app/plugins/CoreAssigner/src/Lib/Jobs/SqlAssignerJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function run(

$this->ia = $this->IdentifierAssignments->get(
$parameters['identifier_assignment_id'],
['contain' => ['SqlAssigners', 'IdentifierTypes']]
contain: ['SqlAssigners', 'IdentifierTypes']
);

if($this->ia->plugin != 'CoreAssigner.SqlAssigners') {
Expand Down
2 changes: 1 addition & 1 deletion app/plugins/CoreJob/src/Lib/Jobs/SyncJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ protected function getRunContext(

$this->runContext->eis = $this->runContext->EISTable->get(
$eisId,
['contain' => $this->runContext->EISTable->getPluginRelations()]
contain: $this->runContext->EISTable->getPluginRelations()
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/plugins/CoreServer/src/Model/Table/SqlServersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function connect(int $serverId, string $name): bool {
// which is basically what the SQL Provisioner does.

// Pull our configuration via the parent Server object.
$server = $this->Servers->get($serverId, ['contain' => ['SqlServers']]);
$server = $this->Servers->get($serverId, contain: ['SqlServers']);

$dbmap = [
RdbmsTypeEnum::MariaDB => 'Mysql',
Expand Down
2 changes: 1 addition & 1 deletion app/src/Controller/AuthenticatorsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function manage() {

$cfg = $this->Authenticators->get(
(int)$this->getRequest()->getQuery('authenticator_id'),
['contain' => $this->Authenticators->getPluginRelations()]
contain: $this->Authenticators->getPluginRelations()
);

// We need to know what type of Authenticator we're managing to construct the redirect.
Expand Down
2 changes: 1 addition & 1 deletion app/src/Controller/ExternalIdentitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ public function relink(string $id) {

$this->set('vv_title', __d('operation', 'relink.a', [__d('controller', 'ExternalIdentities', [1])]));

$this->set('vv_external_identity', $this->ExternalIdentities->get((int)$id, ['contain' => 'Names']));
$this->set('vv_external_identity', $this->ExternalIdentities->get((int)$id, contain: 'Names'));
}}
2 changes: 1 addition & 1 deletion app/src/Controller/PetitionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function finalize(string $id) {
// configuration (eg: EnvSource's duplicate redirect URL) since in theory any plugin
// can trigger this.

$petition = $this->Petitions->get((int)$id, ['contain' => ['EnrollmentFlows']]);
$petition = $this->Petitions->get((int)$id, contain: ['EnrollmentFlows']);

// Redirect to configured URL or default location
if(!empty($petition->enrollment_flow->redirect_on_duplicate)) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/Controller/SingleAuthenticatorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function manage() {

$Authenticators = TableRegistry::getTableLocator()->get('Authenticators');

$authcfg = $Authenticators->get($cfg->authenticator_id, ['contain' => $authModelsName]);
$authcfg = $Authenticators->get($cfg->authenticator_id, contain: $authModelsName);

$status = $Authenticators->AuthenticatorStatuses->getForPerson(
$authcfg,
Expand Down
4 changes: 2 additions & 2 deletions app/src/Model/Table/AuthenticatorsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function lock(int $id, int $personId) {
*/

protected function processLock(int $id, int $personId, string $action) {
$cfg = $this->get($id, ['contain' => $this->getPluginRelations()]);
$cfg = $this->get($id, contain: $this->getPluginRelations());

// Make sure our configuration is active
if($cfg->status != SuspendableStatusEnum::Active) {
Expand Down Expand Up @@ -241,7 +241,7 @@ protected function processLock(int $id, int $personId, string $action) {
*/

public function reset(int $id, int $personId) {
$cfg = $this->get($id, ['contain' => $this->getPluginRelations()]);
$cfg = $this->get($id, contain: $this->getPluginRelations());

// Make sure our configuration is active
if($cfg->status != SuspendableStatusEnum::Active) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/Model/Table/ExternalIdentitiesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function adopt(int $id): int {
]
];

$externalIdentity = $this->get($id, ['contain' => $related]);
$externalIdentity = $this->get($id, contain: $related);

// For each of the top level related models, walk to the Pipelined record on the Person
// and unset the source_ key.
Expand Down Expand Up @@ -515,7 +515,7 @@ public function recalculateStatus(int $id): ?string {

// Start by pulling the roles for this External Identity, along with the EI record

$externalIdentity = $this->get($id, ['contain' => 'ExternalIdentityRoles']);
$externalIdentity = $this->get($id, contain: 'ExternalIdentityRoles');

if(!empty($externalIdentity->external_identity_roles)) {
foreach($externalIdentity->external_identity_roles as $role) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/GroupMembersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public function ruleIsGroupMember($entity, $options) {

if($this->isMember($entity->group_id, $entity->person_id, true, false)) {
// Pull the Person and Group name for the error message.
$person = $this->People->get($entity->person_id, ['contain' => ['PrimaryName']]);
$person = $this->People->get($entity->person_id, contain: ['PrimaryName']);
$group = $this->Groups->get($entity->group_id);

return __d('error', 'exists.GroupMember', [$person->primary_name->full_name, $group->name]);
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/IdentifierAssignmentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function assign(
// this should be less brittle if we add support for another model
// alongside Identifiers and EmailAddresses.)

$entity = $EntityTable->get($entityId, ['contain' => $contains]);
$entity = $EntityTable->get($entityId, contain: $contains);

// Check if there is already an identifier of this type

Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/NotificationsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public function register(
if($subjectPersonId) {
// Retrieve and attach the Subject Person
$messageTemplate->setContextSubjectPerson(
$this->SubjectPeople->get($subjectPersonId, ['contain' => 'PrimaryName'])
$this->SubjectPeople->get($subjectPersonId, contain: 'PrimaryName')
);
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/Model/Table/PetitionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,12 @@ public function getEnrolleeName(int $id): ?string {
// First see if there is an Enrollee Person associated with the Petition, which would
// be the case for (eg) account linking. If so, use their Primary Name.

$petition = $this->get($id, ['contain' => [
$petition = $this->get($id, contain: [
'EnrolleePeople' => 'PrimaryName',
'PetitionStepResults' => [
'EnrollmentFlowSteps' => $this->PetitionStepResults->EnrollmentFlowSteps->getPluginRelations()
]
]]);
]);

if(!empty($petition->enrollee_person->primary_name)) {
return $petition->enrollee_person->primary_name->full_name;
Expand Down
12 changes: 6 additions & 6 deletions app/src/Model/Table/PipelinesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1248,15 +1248,15 @@ public function relink(

$eis = $this->ExternalIdentitySources->get(
$eisRecord->external_identity_source_id,
['contain' => 'Pipelines']
contain: 'Pipelines'
);

$ei = $this->Cos->People->ExternalIdentities->get(
$eisRecord->external_identity_id,
['contain' => [
contain: [
'ExternalIdentityRoles' => 'PersonRoles',
'People'
]]
]
);

// To start the relinking, tell syncPerson to update the source Person with a
Expand Down Expand Up @@ -1527,7 +1527,7 @@ protected function searchByAttribute(
// syncExternalIdentity will pull whatever Person attributes it actually needs.

// AR-Pipeline-2 Pipeline Person Matching ignores the existing Person status.
$person = $SearchTable->People->get($personId, ['contain' => ['Names']]);
$person = $SearchTable->People->get($personId, contain: ['Names']);

// We can't record history yet since we don't have an External Identity
// (we'll do that in execute()), but we can at least log
Expand Down Expand Up @@ -1647,7 +1647,7 @@ protected function syncExternalIdentity(

$externalIdentity = $this->Cos->People->ExternalIdentities->get(
$eisRecord->external_identity_id,
['contain' => [
contain: [
'Addresses',
'AdHocAttributes',
'EmailAddresses',
Expand All @@ -1661,7 +1661,7 @@ protected function syncExternalIdentity(
'Addresses',
'TelephoneNumbers'
]
]]
]
);

// Map the current backend record...
Expand Down

0 comments on commit 4f22a75

Please sign in to comment.