Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: add mapper for vcategory_to_object
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Dec 5, 2024
commit 9be973835e3fed8b7e05953e6878a3bc7d125747
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,8 @@
'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',
Expand Down
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
32 changes: 32 additions & 0 deletions lib/private/Tagging/TagRelation.php
Original file line number Diff line number Diff line change
@@ -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(

Check failure on line 23 in lib/private/Tagging/TagRelation.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ConstructorSignatureMismatch

lib/private/Tagging/TagRelation.php:23:2: ConstructorSignatureMismatch: Method OC\Tagging\TagRelation::__construct has more required parameters than parent method OCP\AppFramework\Db\Entity::__construct (see https://psalm.dev/231)
protected int $objid,
protected int $categoryid,
protected string $type,
) {
$this->addType('objid', 'integer');
$this->addType('categoryid', 'integer');
$this->addType('type', 'string');
}
}
32 changes: 32 additions & 0 deletions lib/private/Tagging/TagRelationMapper.php
Original file line number Diff line number Diff line change
@@ -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();
}
}
Loading