diff options
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 2 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 2 | ||||
-rw-r--r-- | lib/private/Tagging/TagRelation.php | 32 | ||||
-rw-r--r-- | lib/private/Tagging/TagRelationMapper.php | 32 |
4 files changed, 68 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index a30eccfd838..a4952e602d8 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -1994,6 +1994,8 @@ return array( 'OC\\TagManager' => $baseDir . '/lib/private/TagManager.php', 'OC\\Tagging\\Tag' => $baseDir . '/lib/private/Tagging/Tag.php', 'OC\\Tagging\\TagMapper' => $baseDir . '/lib/private/Tagging/TagMapper.php', + 'OC\\Tagging\\TagRelation' => $baseDir . '/lib/private/Tagging/TagRelation.php', + 'OC\\Tagging\\TagRelationMapper' => $baseDir . '/lib/private/Tagging/TagRelationMapper.php', 'OC\\Tags' => $baseDir . '/lib/private/Tags.php', 'OC\\Talk\\Broker' => $baseDir . '/lib/private/Talk/Broker.php', 'OC\\Talk\\ConversationOptions' => $baseDir . '/lib/private/Talk/ConversationOptions.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 9ca1852a071..90cd1d1544d 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -2035,6 +2035,8 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OC\\TagManager' => __DIR__ . '/../../..' . '/lib/private/TagManager.php', 'OC\\Tagging\\Tag' => __DIR__ . '/../../..' . '/lib/private/Tagging/Tag.php', 'OC\\Tagging\\TagMapper' => __DIR__ . '/../../..' . '/lib/private/Tagging/TagMapper.php', + 'OC\\Tagging\\TagRelation' => __DIR__ . '/../../..' . '/lib/private/Tagging/TagRelation.php', + 'OC\\Tagging\\TagRelationMapper' => __DIR__ . '/../../..' . '/lib/private/Tagging/TagRelationMapper.php', 'OC\\Tags' => __DIR__ . '/../../..' . '/lib/private/Tags.php', 'OC\\Talk\\Broker' => __DIR__ . '/../../..' . '/lib/private/Talk/Broker.php', 'OC\\Talk\\ConversationOptions' => __DIR__ . '/../../..' . '/lib/private/Talk/ConversationOptions.php', diff --git a/lib/private/Tagging/TagRelation.php b/lib/private/Tagging/TagRelation.php new file mode 100644 index 00000000000..b5e1b0dcdef --- /dev/null +++ b/lib/private/Tagging/TagRelation.php @@ -0,0 +1,32 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OC\Tagging; + +use OCP\AppFramework\Db\Entity; + +/** + * + * @method int getObjid() + * @method void setObjid(int $objid) + * @method int getCategoryid() + * @method void setCategoryid(int $categoryid) + * @method string getType() + * @method void setType(string $type) + */ +class TagRelation extends Entity { + public function __construct( + protected int $objid, + protected int $categoryid, + protected string $type, + ) { + $this->addType('objid', 'integer'); + $this->addType('categoryid', 'integer'); + $this->addType('type', 'string'); + } +} diff --git a/lib/private/Tagging/TagRelationMapper.php b/lib/private/Tagging/TagRelationMapper.php new file mode 100644 index 00000000000..f37cc47b7b8 --- /dev/null +++ b/lib/private/Tagging/TagRelationMapper.php @@ -0,0 +1,32 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OC\Tagging; + +use OCP\AppFramework\Db\QBMapper; +use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\IDBConnection; + +/** + * @template-extends QBMapper<TagRelation> + */ +class TagRelationMapper extends QBMapper { + + public function __construct(IDBConnection $db) { + parent::__construct($db, 'vcategory_to_object', TagRelation::class); + } + + public function deleteByObjidAndTagIds(int $objid, array $tagIds): void { + $qb = $this->db->getQueryBuilder(); + $qb->delete($this->getTableName()) + ->where($qb->expr()->eq('objid', $qb->createNamedParameter($objid, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)) + ->andWhere($qb->expr()->in('categoryid', $qb->createNamedParameter($tagIds, IQueryBuilder::PARAM_INT_ARRAY)), IQueryBuilder::PARAM_INT_ARRAY); + + $qb->executeStatement(); + } +} |