From 0b300ad2a02c57a6dce05e9cb34d68369d9c5288 Mon Sep 17 00:00:00 2001 From: gluafamichl <> Date: Fri, 25 Oct 2024 10:39:30 +0200 Subject: [PATCH] Mod: refactor: change function name getManyToOneRelationViaIntermediate to getManyToManyRelation --- src/inc/apiv2/common/AbstractModelAPI.class.php | 4 ++-- src/inc/apiv2/model/accessgroups.routes.php | 4 ++-- src/inc/apiv2/model/agents.routes.php | 2 +- src/inc/apiv2/model/hashlists.routes.php | 4 ++-- src/inc/apiv2/model/pretasks.routes.php | 2 +- src/inc/apiv2/model/supertasks.routes.php | 2 +- src/inc/apiv2/model/tasks.routes.php | 6 +++--- src/inc/apiv2/model/users.routes.php | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/inc/apiv2/common/AbstractModelAPI.class.php b/src/inc/apiv2/common/AbstractModelAPI.class.php index 84517e70c..2df711125 100644 --- a/src/inc/apiv2/common/AbstractModelAPI.class.php +++ b/src/inc/apiv2/common/AbstractModelAPI.class.php @@ -118,7 +118,7 @@ final protected static function getManyToOneRelation( /** - * Retrieve ManyToOne relalation for $objects ('parents') of type $targetFactory via 'intermidate' + * Retrieve ManyToMany relation for $objects ('parents') of type $targetFactory via 'intermediate' * of $intermediateFactory joining on $joinField (between 'intermediate' and 'target'). Filtered by * $filterField at $intermediateFactory. * @@ -131,7 +131,7 @@ final protected static function getManyToOneRelation( * @return array */ - final protected static function getManyToOneRelationViaIntermediate( + final protected static function getManyToManyRelation( array $objects, string $objectField, object $intermediateFactory, diff --git a/src/inc/apiv2/model/accessgroups.routes.php b/src/inc/apiv2/model/accessgroups.routes.php index 50d8a4fa5..493b88f38 100644 --- a/src/inc/apiv2/model/accessgroups.routes.php +++ b/src/inc/apiv2/model/accessgroups.routes.php @@ -30,7 +30,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { /* Expand requested section */ switch($expand) { case 'userMembers': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, AccessGroup::ACCESS_GROUP_ID, Factory::getAccessGroupUserFactory(), @@ -39,7 +39,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { User::USER_ID ); case 'agentMembers': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, AccessGroup::ACCESS_GROUP_ID, Factory::getAccessGroupAgentFactory(), diff --git a/src/inc/apiv2/model/agents.routes.php b/src/inc/apiv2/model/agents.routes.php index b46a4779b..9a056cf88 100644 --- a/src/inc/apiv2/model/agents.routes.php +++ b/src/inc/apiv2/model/agents.routes.php @@ -33,7 +33,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { /* Expand requested section */ switch($expand) { case 'accessGroups': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Agent::AGENT_ID, Factory::getAccessGroupAgentFactory(), diff --git a/src/inc/apiv2/model/hashlists.routes.php b/src/inc/apiv2/model/hashlists.routes.php index 159b4eeef..bb4b14f80 100644 --- a/src/inc/apiv2/model/hashlists.routes.php +++ b/src/inc/apiv2/model/hashlists.routes.php @@ -58,7 +58,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { ); case 'hashlists': /* PARENT_HASHLIST_ID in use in intermediate table */ - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Hashlist::HASHLIST_ID, Factory::getHashlistHashlistFactory(), @@ -67,7 +67,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { Hashlist::HASHLIST_ID, ); case 'tasks': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Hashlist::HASHLIST_ID, Factory::getTaskWrapperFactory(), diff --git a/src/inc/apiv2/model/pretasks.routes.php b/src/inc/apiv2/model/pretasks.routes.php index 89a091c7f..592d59278 100644 --- a/src/inc/apiv2/model/pretasks.routes.php +++ b/src/inc/apiv2/model/pretasks.routes.php @@ -31,7 +31,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { /* Expand requested section */ switch($expand) { case 'pretaskFiles': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Pretask::PRETASK_ID, Factory::getFilePretaskFactory(), diff --git a/src/inc/apiv2/model/supertasks.routes.php b/src/inc/apiv2/model/supertasks.routes.php index deec64475..11a68c90f 100644 --- a/src/inc/apiv2/model/supertasks.routes.php +++ b/src/inc/apiv2/model/supertasks.routes.php @@ -30,7 +30,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { /* Expand requested section */ switch($expand) { case 'pretasks': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Supertask::SUPERTASK_ID, Factory::getSupertaskPretaskFactory(), diff --git a/src/inc/apiv2/model/tasks.routes.php b/src/inc/apiv2/model/tasks.routes.php index 4244ac679..fa603f6f5 100644 --- a/src/inc/apiv2/model/tasks.routes.php +++ b/src/inc/apiv2/model/tasks.routes.php @@ -34,7 +34,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { /* Expand requested section */ switch($expand) { case 'assignedAgents': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Task::TASK_ID, Factory::getAssignmentFactory(), @@ -57,7 +57,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { CrackerBinaryType::CRACKER_BINARY_TYPE_ID ); case 'hashlist': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Task::TASK_WRAPPER_ID, Factory::getTaskWrapperFactory(), @@ -73,7 +73,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { Speed::TASK_ID ); case 'files': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, Task::TASK_ID, Factory::getFileTaskFactory(), diff --git a/src/inc/apiv2/model/users.routes.php b/src/inc/apiv2/model/users.routes.php index d1214fe5a..c43877966 100644 --- a/src/inc/apiv2/model/users.routes.php +++ b/src/inc/apiv2/model/users.routes.php @@ -31,7 +31,7 @@ protected function fetchExpandObjects(array $objects, string $expand): mixed { /* Expand requested section */ switch($expand) { case 'accessGroups': - return $this->getManyToOneRelationViaIntermediate( + return $this->getManyToManyRelation( $objects, User::USER_ID, Factory::getAccessGroupUserFactory(),