Skip to content

Commit

Permalink
cakephp5 deprecation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Sep 12, 2025
1 parent d901a90 commit 8bac2ef
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function dispatch(string $id) {

// Pull our configuration

$envSource = $this->EnvSourceCollectors->get((int)$id, ['contain' => ['ExternalIdentitySources' => 'EnvSources']]);
$envSource = $this->EnvSourceCollectors->get((int)$id, contain: ['ExternalIdentitySources' => 'EnvSources']);

try {
$vars = $this->EnvSourceCollectors->parse($envSource->external_identity_source->env_source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function hydrate(int $id, \App\Model\Entity\Petition $petition) {

$eis = $ExtIdentitySources->get(
$cfg->external_identity_source_id,
['contain' => 'EnvSources']
contain: 'EnvSources'
);

$eisrecord = $EnvSources->retrieve($eis, $pei->env_source_identity->source_key);
Expand Down Expand Up @@ -514,7 +514,7 @@ public function verifiableEmailAddresses(

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

$defaultVerified = isset($eis->pipeline->sync_verify_email_addresses)
Expand Down
2 changes: 1 addition & 1 deletion app/src/Controller/PetitionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function finalize(string $id) {
// We only use the Redirect on Finalize URL (if specified) on success,
// since otherwise the Flash error won't render

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

if(!empty($petition->enrollment_flow->redirect_on_finalize)) {
return $this->redirect($petition->enrollment_flow->redirect_on_finalize);
Expand Down
5 changes: 3 additions & 2 deletions app/src/Controller/StandardEnrollerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public function calculatePermission(): bool {
return false;
}

$stepConfig = $this->getCurrentTable()->get($modelId, ['contain' => ['EnrollmentFlowSteps' => ['EnrollmentFlows']]]);
$stepConfig = $this->getCurrentTable()
->get($modelId, contain: ['EnrollmentFlowSteps' => ['EnrollmentFlows']]);
$this->set('vv_step_config', $stepConfig);
$this->set('vv_title', $stepConfig['enrollment_flow_step']['enrollment_flow']['name']);

Expand Down Expand Up @@ -229,7 +230,7 @@ public function willHandleAuth(\Cake\Event\EventInterface $event): string {
return 'notauth';
}

$stepConfig = $this->getCurrentTable()->get($modelId, ['contain' => 'EnrollmentFlowSteps']);
$stepConfig = $this->getCurrentTable()->get($modelId, contain: 'EnrollmentFlowSteps');

// Determine if the requested step is past the current/next step.
// We don't allow steps that haven't run yet to be run out of order.
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/ExternalIdentitiesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public function beforeDelete(\Cake\Event\Event $event, $entity, \ArrayObject $op
$this->Names->delete($n, ['checkRules' => false]);
}

return true;
$event->setResult(true);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/src/Model/Table/ExternalIdentityRolesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ public function beforeDelete(\Cake\Event\Event $event, $entity, \ArrayObject $op
}

$this->recordHistory(entity: $entity, action: ActionEnum::MVEADeleted);
return true;

$event->setResult(true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/ExternalIdentitySourcesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function getEIS(int $id) {
// the query simpler we contain all possible relations, which will
// usually only be a small number.
if(empty($this->eisCache[$id])) {
$this->eisCache[$id] = $this->get($id, ['contain' => $this->getPluginRelations()]);
$this->eisCache[$id] = $this->get($id, contain: $this->getPluginRelations());
}

return $this->eisCache[$id];
Expand Down
6 changes: 3 additions & 3 deletions app/src/Model/Table/GroupMembersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function isMember(int $groupId,

public function localAfterSave(\Cake\Event\EventInterface $event, \Cake\Datasource\EntityInterface $entity, \ArrayObject $options): bool {
// Pull the related entities for HistoryRecord comment creation.
$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);

$action = null;
Expand All @@ -259,8 +259,8 @@ public function localAfterSave(\Cake\Event\EventInterface $event, \Cake\Datasour
// We need to allow retrieval of archived records since we might be called
// after the GroupNesting was deleted
$nesting = $this->GroupNestings->get($entity->group_nesting_id,
['contain' => ['Groups'],
'archived' => true]);
contain: ['Groups'],
archived: true);

$langKeySuffix = '.nesting';
$commentParams[] = $nesting->group->name;
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/GroupsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function beforeDelete(EventInterface $event, $entity, \ArrayObject $optio
// to look at the archived data.
}

return true;
$event->setResult(true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/NamesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function localAfterSave(\Cake\Event\EventInterface $event, \Cake\Datasour
*/

public function primaryName(int $id, string $recordType='person', array $options = []) {
$query = empty($options) ? $this->find() : $this->find('all', $options);
$query = empty($options) ? $this->find() : $this->find('all', ...$options);
if($recordType == 'person') {
// Return the Primary Name

Expand Down
12 changes: 6 additions & 6 deletions app/src/Model/Table/PeopleTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public function beforeDelete(\Cake\Event\Event $event, $entity, \ArrayObject $op
}
}

return true;
$event->setResult(true);
}

/**
Expand Down Expand Up @@ -469,10 +469,10 @@ public function localAfterSave(\Cake\Event\EventInterface $event, \Cake\Datasour
public function marshalProvisioningData(int $id): array {
$ret = [];

$ret['data'] = $this->get($id, [
$ret['data'] = $this->get($id,
// We need archives for handling deleted records
'archived' => 'true',
'contain' => [
archived: 'true',
contain: [
'PrimaryName' => [ 'Types' ],
'Addresses' => [ 'Types' ],
'AdHocAttributes',
Expand Down Expand Up @@ -510,7 +510,7 @@ public function marshalProvisioningData(int $id): array {
'TelephoneNumbers' => [ 'Types' ],
'Urls' => [ 'Types' ]
]
]);
);

// Provisioning Eligibility is
// - Deleted if the changelog deleted flag is true OR status is Archived
Expand Down Expand Up @@ -620,7 +620,7 @@ public function recalculateStatus(int $id): ?string {

// Start by pulling the roles for this person, along with the Person record

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

if(!empty($person->person_roles)) {
foreach($person->person_roles as $role) {
Expand Down
12 changes: 6 additions & 6 deletions app/src/Model/Table/PetitionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ public function buildRules(RulesChecker $rules): RulesChecker {
*/

public function derive(int $id) {
$petition = $this->get($id, ['contain' => [
$petition = $this->get($id, contain: [
'EnrollmentFlows' => [
'EnrollmentFlowSteps' => array_merge(
$this->EnrollmentFlows->EnrollmentFlowSteps->getPluginRelations(),
['sort' => ['EnrollmentFlowSteps.ordr' => 'ASC']]
)
]]]);
]]);

if($petition->isComplete()) {
throw new \InvalidArgumentException(__d('error', 'Petitions.completed', [$id]));
Expand Down Expand Up @@ -380,7 +380,7 @@ public function derive(int $id) {
*/

public function finalize(int $id) {
$petition = $this->get($id, ['contain' => 'EnrollmentFlows']);
$petition = $this->get($id, contain: 'EnrollmentFlows');

if($petition->isComplete()) {
throw new \InvalidArgumentException(__d('error', 'Petitions.completed', [$id]));
Expand Down Expand Up @@ -421,7 +421,7 @@ public function finalize(int $id) {
$template->generateMessage();

if(!DeliveryUtilities::sendEmailToAddress(
coId: $coId,
coId: $petition->enrollment_flow->co_id,
recipient: $petition->enrollee_email,
subject: $template->getMessagePart('subject'),
body_text: $template->getMessagePart('body_text'),
Expand Down Expand Up @@ -574,13 +574,13 @@ public function hydrate(int $id) {
// This is intended to be the first part of finalization, so we set the Petition status
// to Finalizing.

$petition = $this->get($id, ['contain' => [
$petition = $this->get($id, contain: [
'EnrollmentFlows' => [
'EnrollmentFlowSteps' => array_merge(
$this->EnrollmentFlows->EnrollmentFlowSteps->getPluginRelations(),
['sort' => ['EnrollmentFlowSteps.ordr' => 'ASC']]
)
]]]);
]]);

if($petition->isComplete()) {
throw new \InvalidArgumentException(__d('error', 'Petitions.completed', [$id]));
Expand Down
4 changes: 2 additions & 2 deletions app/src/Model/Table/PipelinesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ protected function syncPerson(
if($externalIdentityId) {
$externalIdentity = $this->Cos->People->ExternalIdentities->get(
$externalIdentityId,
['contain' => [
contain: [
'Addresses',
'AdHocAttributes',
'EmailAddresses',
Expand All @@ -1955,7 +1955,7 @@ protected function syncPerson(
'Addresses',
'TelephoneNumbers'
]
]]
]
);
} else {
$externalIdentity = null;
Expand Down

0 comments on commit 8bac2ef

Please sign in to comment.