From 3d1fdfaab0a276ce4baaa77d665623e2bffe3338 Mon Sep 17 00:00:00 2001 From: Alex Zamponi <562324+alexz707@users.noreply.github.com> Date: Wed, 22 May 2024 14:29:24 +0200 Subject: [PATCH 1/5] Add Tag resolver --- src/Models/Tag/TagResolver.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Models/Tag/TagResolver.php diff --git a/src/Models/Tag/TagResolver.php b/src/Models/Tag/TagResolver.php new file mode 100644 index 0000000..3f313bd --- /dev/null +++ b/src/Models/Tag/TagResolver.php @@ -0,0 +1,13 @@ + Date: Mon, 27 May 2024 09:29:53 +0200 Subject: [PATCH 2/5] Add tagsForElement --- src/Models/Tag/TagResolver.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Models/Tag/TagResolver.php b/src/Models/Tag/TagResolver.php index 3f313bd..190bcc6 100644 --- a/src/Models/Tag/TagResolver.php +++ b/src/Models/Tag/TagResolver.php @@ -10,4 +10,12 @@ public function getById(int $id): ?Tag { return Tag::getById($id); } + + /** + * @return array + */ + public function getTagsForElement(string $cType, int $cId): array + { + return Tag::getTagsForElement($cType, $cId); + } } \ No newline at end of file From 94808bbde1caafd3b04318360612306bf8a37291 Mon Sep 17 00:00:00 2001 From: Alex Zamponi <562324+alexz707@users.noreply.github.com> Date: Wed, 29 May 2024 15:25:13 +0200 Subject: [PATCH 3/5] Add batch methods + interface --- src/Models/Tag/TagResolver.php | 33 +++++++++++++++++++++++-- src/Models/Tag/TagResolverInterface.php | 32 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 src/Models/Tag/TagResolverInterface.php diff --git a/src/Models/Tag/TagResolver.php b/src/Models/Tag/TagResolver.php index 190bcc6..7198254 100644 --- a/src/Models/Tag/TagResolver.php +++ b/src/Models/Tag/TagResolver.php @@ -1,10 +1,11 @@ $cIds + * @param array $tagIds + */ + public function batchAssignTagsToElements(string $cType, array $cIds, array $tagIds): void + { + Tag::batchAssignTagsToElement($cType, $cIds, $tagIds); + } + + /** + * @param array $cIds + * @param array $tagIds + */ + public function batchReplaceTagsForElements(string $cType, array $cIds, array $tagIds): void + { + Tag::batchAssignTagsToElement($cType, $cIds, $tagIds, true); + } +} diff --git a/src/Models/Tag/TagResolverInterface.php b/src/Models/Tag/TagResolverInterface.php new file mode 100644 index 0000000..6bf863c --- /dev/null +++ b/src/Models/Tag/TagResolverInterface.php @@ -0,0 +1,32 @@ + + */ + public function getTagsForElement(string $cType, int $cId): array; + + public function assignTagToElement(string $cType, int $cId, Tag $tag): void; + + public function unassignTagFromElement(string $cType, int $cId, Tag $tag): void; + + /** + * @param array $cIds + * @param array $tagIds + */ + public function batchAssignTagsToElements(string $cType, array $cIds, array $tagIds): void; + + /** + * @param array $cIds + * @param array $tagIds + */ + public function batchReplaceTagsForElements(string $cType, array $cIds, array $tagIds): void; +} From 06d972b92101df801a8293932cf474bddc556d3f Mon Sep 17 00:00:00 2001 From: alexz707 Date: Wed, 29 May 2024 13:41:38 +0000 Subject: [PATCH 4/5] Apply php-cs-fixer changes --- src/Models/Tag/TagResolver.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Models/Tag/TagResolver.php b/src/Models/Tag/TagResolver.php index 190bcc6..5c09d69 100644 --- a/src/Models/Tag/TagResolver.php +++ b/src/Models/Tag/TagResolver.php @@ -1,5 +1,18 @@ Date: Wed, 29 May 2024 14:40:41 +0000 Subject: [PATCH 5/5] Apply php-cs-fixer changes --- src/Models/Tag/TagResolverInterface.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Models/Tag/TagResolverInterface.php b/src/Models/Tag/TagResolverInterface.php index 6bf863c..692760f 100644 --- a/src/Models/Tag/TagResolverInterface.php +++ b/src/Models/Tag/TagResolverInterface.php @@ -1,6 +1,19 @@