Merge pull request #23437 from owncloud/save-query-when-the-list-is-empty
Save the query when we get tags for no objects
This commit is contained in:
commit
6aa28037c7
|
@ -64,6 +64,8 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
|
|||
public function getTagIdsForObjects($objIds, $objectType) {
|
||||
if (!is_array($objIds)) {
|
||||
$objIds = [$objIds];
|
||||
} else if (empty($objIds)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
|
|
|
@ -119,7 +119,7 @@ class SystemTagObjectMapperTest extends TestCase {
|
|||
$query->delete(SystemTagManager::TAG_TABLE)->execute();
|
||||
}
|
||||
|
||||
public function testGetTagsForObjects() {
|
||||
public function testGetTagIdsForObjects() {
|
||||
$tagIdMapping = $this->tagMapper->getTagIdsForObjects(
|
||||
['1', '2', '3', '4'],
|
||||
'testtype'
|
||||
|
@ -133,6 +133,15 @@ class SystemTagObjectMapperTest extends TestCase {
|
|||
], $tagIdMapping);
|
||||
}
|
||||
|
||||
public function testGetTagIdsForNoObjects() {
|
||||
$tagIdMapping = $this->tagMapper->getTagIdsForObjects(
|
||||
[],
|
||||
'testtype'
|
||||
);
|
||||
|
||||
$this->assertEquals([], $tagIdMapping);
|
||||
}
|
||||
|
||||
public function testGetObjectsForTags() {
|
||||
$objectIds = $this->tagMapper->getObjectIdsForTags(
|
||||
[$this->tag1->getId(), $this->tag2->getId(), $this->tag3->getId()],
|
||||
|
|
Loading…
Reference in New Issue