From c015b9879d8695fc6738c9c8c4fbd14104b5242b Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Mon, 24 Feb 2025 18:43:20 +0200 Subject: [PATCH] Rename saveAttributes method to saveAttributeCollectorPetitionAttributes --- .../src/Model/Table/AttributeCollectorsTable.php | 8 ++++---- app/src/Model/Table/AdHocAttributesTable.php | 2 +- app/src/Model/Table/AddressesTable.php | 2 +- app/src/Model/Table/EmailAddressesTable.php | 2 +- app/src/Model/Table/GroupMembersTable.php | 2 +- app/src/Model/Table/NamesTable.php | 2 +- app/src/Model/Table/PeopleTable.php | 2 +- app/src/Model/Table/PersonRolesTable.php | 2 +- app/src/Model/Table/PronounsTable.php | 2 +- app/src/Model/Table/TelephoneNumbersTable.php | 2 +- app/src/Model/Table/UrlsTable.php | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php b/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php index 00dff6e45..d2861922b 100644 --- a/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php +++ b/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php @@ -177,7 +177,7 @@ public function hydrate(int $id, \App\Model\Entity\Petition $petition): bool // Save the Person Role $personRoleObj = TableRegistry::getTableLocator()->get('PersonRoles'); - $role = $personRoleObj->saveAttributes((int)$person->id, $fieldsForPersonRole); + $role = $personRoleObj->saveAttributeCollectorPetitionAttributes((int)$person->id, $fieldsForPersonRole); /********* MVEAS **************/ // Filter the MVEAS Attributes and keep the field name @@ -218,7 +218,7 @@ public function hydrate(int $id, \App\Model\Entity\Petition $petition): bool return in_array($attr['enrollment_attribute']['attribute'], $personAttributes); })->toArray(); - $People->saveAttributes($person->id, $fieldsForPerson); + $People->saveAttributeCollectorPetitionAttributes($person->id, $fieldsForPerson); /****** GROUP ******/ // Filter the MVEAS Attributes and keep the field name @@ -233,7 +233,7 @@ public function hydrate(int $id, \App\Model\Entity\Petition $petition): bool })->toArray(); $groupMemberObj = TableRegistry::getTableLocator()->get('GroupMembers'); - $groupMemberObj->saveAttributes($person->id, $fieldsForGroup); + $groupMemberObj->saveAttributeCollectorPetitionAttributes($person->id, $fieldsForGroup); // Save the Date Of Birth. This is the only one that is single valued // and goes under the Person @@ -293,7 +293,7 @@ protected function handleMveaAttributes( $mveaModel = $supportedAttributes[$attribute]['mveaModel']; $modelObj = TableRegistry::getTableLocator()->get($mveaModel); - $modelObj->saveAttributes((int)$person->id, $role?->id, $mveaParent, $fieldsForAttribute); + $modelObj->saveAttributeCollectorPetitionAttributes((int)$person->id, $role?->id, $mveaParent, $fieldsForAttribute); } } diff --git a/app/src/Model/Table/AdHocAttributesTable.php b/app/src/Model/Table/AdHocAttributesTable.php index 212857ce3..d40583e7b 100644 --- a/app/src/Model/Table/AdHocAttributesTable.php +++ b/app/src/Model/Table/AdHocAttributesTable.php @@ -160,7 +160,7 @@ public function validationDefault(Validator $validator): Validator { * @throws \InvalidArgumentException Thrown if required parameters are missing or invalid * @throws \Cake\ORM\Exception\PersistenceFailedException If saving the entity fails */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { foreach ($fields as $idx => $field) { // Check if this has already been saved diff --git a/app/src/Model/Table/AddressesTable.php b/app/src/Model/Table/AddressesTable.php index 056dfd253..6fbb89e99 100644 --- a/app/src/Model/Table/AddressesTable.php +++ b/app/src/Model/Table/AddressesTable.php @@ -293,7 +293,7 @@ public function getPermittedFields(): array { * @throws \InvalidArgumentException If required parameters are missing * @throws \Cake\ORM\Exception\PersistenceFailedException If the entity could not be saved */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { $address = []; diff --git a/app/src/Model/Table/EmailAddressesTable.php b/app/src/Model/Table/EmailAddressesTable.php index a8dd7cc4a..ebda330e0 100644 --- a/app/src/Model/Table/EmailAddressesTable.php +++ b/app/src/Model/Table/EmailAddressesTable.php @@ -383,7 +383,7 @@ public function validationDefault(Validator $validator): Validator { * @throws \Cake\Datasource\Exception\RecordNotFoundException * @throws \Cake\ORM\Exception\PersistenceFailedException */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { foreach ($fields as $idx => $field) { // Check if this has already been saved diff --git a/app/src/Model/Table/GroupMembersTable.php b/app/src/Model/Table/GroupMembersTable.php index 916b83434..98c0a2a2d 100644 --- a/app/src/Model/Table/GroupMembersTable.php +++ b/app/src/Model/Table/GroupMembersTable.php @@ -565,7 +565,7 @@ public function validationDefault(Validator $validator): Validator { * @return GroupMember The saved entity representing the person's role. * */ - public function saveAttributes(int $personId, array $fields): GroupMember + public function saveAttributeCollectorPetitionAttributes(int $personId, array $fields): GroupMember { $member = [ 'person_id' => $personId, diff --git a/app/src/Model/Table/NamesTable.php b/app/src/Model/Table/NamesTable.php index dfd93d6f1..7e912a876 100644 --- a/app/src/Model/Table/NamesTable.php +++ b/app/src/Model/Table/NamesTable.php @@ -447,7 +447,7 @@ public function validationDefault(Validator $validator): Validator { * @return bool Returns true on successful save, throws exception otherwise. * @throws \Cake\ORM\Exception\PersistenceFailedException If the entity could not be saved. */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { $name = [ 'person_id' => $personId, diff --git a/app/src/Model/Table/PeopleTable.php b/app/src/Model/Table/PeopleTable.php index d35adea45..44ea67597 100644 --- a/app/src/Model/Table/PeopleTable.php +++ b/app/src/Model/Table/PeopleTable.php @@ -749,7 +749,7 @@ public function validationDefault(Validator $validator): Validator { * @return Person The updated person entity after saving. * @since COmanage Registry v5.1.0 */ - public function saveAttributes(int $personId, array $fields): Person + public function saveAttributeCollectorPetitionAttributes(int $personId, array $fields): Person { $person = $this->get($personId); foreach ($fields as $field) { diff --git a/app/src/Model/Table/PersonRolesTable.php b/app/src/Model/Table/PersonRolesTable.php index 028283029..9190704bb 100644 --- a/app/src/Model/Table/PersonRolesTable.php +++ b/app/src/Model/Table/PersonRolesTable.php @@ -721,7 +721,7 @@ public function validationDefault(Validator $validator): Validator { * @throws \Cake\Datasource\Exception\RecordNotFoundException If an issue occurs during saving * @since COmanage Registry v5.1.0 */ - public function saveAttributes(int $personId, array $fields): PersonRole + public function saveAttributeCollectorPetitionAttributes(int $personId, array $fields): PersonRole { $dateFormat = 'yyyy-MM-dd HH:mm:ss'; diff --git a/app/src/Model/Table/PronounsTable.php b/app/src/Model/Table/PronounsTable.php index f9fa006b0..c974c2d49 100644 --- a/app/src/Model/Table/PronounsTable.php +++ b/app/src/Model/Table/PronounsTable.php @@ -187,7 +187,7 @@ public function validationDefault(Validator $validator): Validator { * @param array $fields Array of attributes to save * @return bool True on success, false otherwise */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { foreach ($fields as $idx => $field) { // Check if this has already been saved diff --git a/app/src/Model/Table/TelephoneNumbersTable.php b/app/src/Model/Table/TelephoneNumbersTable.php index 0dd96503a..564a56371 100644 --- a/app/src/Model/Table/TelephoneNumbersTable.php +++ b/app/src/Model/Table/TelephoneNumbersTable.php @@ -233,7 +233,7 @@ public function validationDefault(Validator $validator): Validator { * @throws \Cake\ORM\Exception\PersistenceFailedException If saving the entity fails. * @since COmanage Registry v5.1.0 */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { $telephone = []; diff --git a/app/src/Model/Table/UrlsTable.php b/app/src/Model/Table/UrlsTable.php index 24045f37f..85b258b3a 100644 --- a/app/src/Model/Table/UrlsTable.php +++ b/app/src/Model/Table/UrlsTable.php @@ -205,7 +205,7 @@ public function validationDefault(Validator $validator): Validator { * @param array $fields Array of attributes to save * @return bool True on success, false otherwise */ - public function saveAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool + public function saveAttributeCollectorPetitionAttributes(int $personId, ?int $roleId, string $parentModel, array $fields): bool { foreach ($fields as $idx => $field) { // Check if this has already been saved