Fix use statements
This commit is contained in:
parent
6816b36cdb
commit
aa1a0a15ea
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
namespace OC\SystemTag;
|
namespace OC\SystemTag;
|
||||||
|
|
||||||
use \OCP\IDBConnection;
|
use OCP\SystemTag\ISystemTag;
|
||||||
|
|
||||||
class SystemTag implements \OCP\SystemTag\ISystemTag {
|
class SystemTag implements ISystemTag {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
|
|
||||||
namespace OC\SystemTag;
|
namespace OC\SystemTag;
|
||||||
|
|
||||||
use \OCP\IDBConnection;
|
use Doctrine\DBAL\Connection;
|
||||||
use \OCP\SystemTag\TagNotFoundException;
|
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||||
use \OCP\SystemTag\TagAlreadyExistsException;
|
use OCP\IDBConnection;
|
||||||
|
use OCP\SystemTag\ISystemTagManager;
|
||||||
|
use OCP\SystemTag\TagAlreadyExistsException;
|
||||||
|
use OCP\SystemTag\TagNotFoundException;
|
||||||
|
|
||||||
use \Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
class SystemTagManager implements ISystemTagManager {
|
||||||
|
|
||||||
class SystemTagManager implements \OCP\SystemTag\ISystemTagManager {
|
|
||||||
|
|
||||||
const TAG_TABLE = 'systemtag';
|
const TAG_TABLE = 'systemtag';
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ class SystemTagManager implements \OCP\SystemTag\ISystemTagManager {
|
||||||
->addOrderBy('name', 'ASC')
|
->addOrderBy('name', 'ASC')
|
||||||
->addOrderBy('visibility', 'ASC')
|
->addOrderBy('visibility', 'ASC')
|
||||||
->addOrderBy('editable', 'ASC')
|
->addOrderBy('editable', 'ASC')
|
||||||
->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
|
->setParameter('tagids', $tagIds, Connection::PARAM_INT_ARRAY);
|
||||||
|
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
while ($row = $result->fetch()) {
|
while ($row = $result->fetch()) {
|
||||||
|
@ -243,13 +244,13 @@ class SystemTagManager implements \OCP\SystemTag\ISystemTagManager {
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->delete(SystemTagObjectMapper::RELATION_TABLE)
|
$query->delete(SystemTagObjectMapper::RELATION_TABLE)
|
||||||
->where($query->expr()->in('systemtagid', $query->createParameter('tagids')))
|
->where($query->expr()->in('systemtagid', $query->createParameter('tagids')))
|
||||||
->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
|
->setParameter('tagids', $tagIds, Connection::PARAM_INT_ARRAY)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->delete(self::TAG_TABLE)
|
$query->delete(self::TAG_TABLE)
|
||||||
->where($query->expr()->in('id', $query->createParameter('tagids')))
|
->where($query->expr()->in('id', $query->createParameter('tagids')))
|
||||||
->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
|
->setParameter('tagids', $tagIds, Connection::PARAM_INT_ARRAY);
|
||||||
|
|
||||||
if ($query->execute() === 0) {
|
if ($query->execute() === 0) {
|
||||||
throw new TagNotFoundException(
|
throw new TagNotFoundException(
|
||||||
|
|
|
@ -21,12 +21,15 @@
|
||||||
|
|
||||||
namespace OC\SystemTag;
|
namespace OC\SystemTag;
|
||||||
|
|
||||||
use \OCP\SystemTag\ISystemTagManager;
|
use Doctrine\DBAL\Connection;
|
||||||
use \OCP\IDBConnection;
|
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||||
use \OCP\SystemTag\TagNotFoundException;
|
use OCP\IDBConnection;
|
||||||
use \Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
use OCP\SystemTag\ISystemTag;
|
||||||
|
use OCP\SystemTag\ISystemTagManager;
|
||||||
|
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||||
|
use OCP\SystemTag\TagNotFoundException;
|
||||||
|
|
||||||
class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
|
class SystemTagObjectMapper implements ISystemTagObjectMapper {
|
||||||
|
|
||||||
const RELATION_TABLE = 'systemtag_object_mapping';
|
const RELATION_TABLE = 'systemtag_object_mapping';
|
||||||
|
|
||||||
|
@ -64,7 +67,7 @@ class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
|
||||||
->from(self::RELATION_TABLE)
|
->from(self::RELATION_TABLE)
|
||||||
->where($query->expr()->in('objectid', $query->createParameter('objectids')))
|
->where($query->expr()->in('objectid', $query->createParameter('objectids')))
|
||||||
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
|
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
|
||||||
->setParameter('objectids', $objIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
|
->setParameter('objectids', $objIds, Connection::PARAM_INT_ARRAY)
|
||||||
->setParameter('objecttype', $objectType)
|
->setParameter('objecttype', $objectType)
|
||||||
->addOrderBy('objectid', 'ASC')
|
->addOrderBy('objectid', 'ASC')
|
||||||
->addOrderBy('systemtagid', 'ASC');
|
->addOrderBy('systemtagid', 'ASC');
|
||||||
|
@ -100,7 +103,7 @@ class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
|
||||||
->from(self::RELATION_TABLE)
|
->from(self::RELATION_TABLE)
|
||||||
->where($query->expr()->in('systemtagid', $query->createParameter('tagids')))
|
->where($query->expr()->in('systemtagid', $query->createParameter('tagids')))
|
||||||
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
|
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
|
||||||
->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
|
->setParameter('tagids', $tagIds, Connection::PARAM_INT_ARRAY)
|
||||||
->setParameter('objecttype', $objectType);
|
->setParameter('objecttype', $objectType);
|
||||||
|
|
||||||
$objectIds = [];
|
$objectIds = [];
|
||||||
|
@ -158,7 +161,7 @@ class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
|
||||||
->andWhere($query->expr()->in('systemtagid', $query->createParameter('tagids')))
|
->andWhere($query->expr()->in('systemtagid', $query->createParameter('tagids')))
|
||||||
->setParameter('objectid', $objId)
|
->setParameter('objectid', $objId)
|
||||||
->setParameter('objecttype', $objectType)
|
->setParameter('objecttype', $objectType)
|
||||||
->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
|
->setParameter('tagids', $tagIds, Connection::PARAM_INT_ARRAY)
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +177,7 @@ class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
|
||||||
->where($query->expr()->in('objectid', $query->createParameter('objectids')))
|
->where($query->expr()->in('objectid', $query->createParameter('objectids')))
|
||||||
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
|
->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
|
||||||
->andWhere($query->expr()->eq('systemtagid', $query->createParameter('tagid')))
|
->andWhere($query->expr()->eq('systemtagid', $query->createParameter('tagid')))
|
||||||
->setParameter('objectids', $objIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
|
->setParameter('objectids', $objIds, Connection::PARAM_INT_ARRAY)
|
||||||
->setParameter('tagid', $tagId)
|
->setParameter('tagid', $tagId)
|
||||||
->setParameter('objecttype', $objectType)
|
->setParameter('objecttype', $objectType)
|
||||||
->setMaxResults(1);
|
->setMaxResults(1);
|
||||||
|
@ -201,7 +204,7 @@ class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
|
||||||
if (count($tags) !== count($tagIds)) {
|
if (count($tags) !== count($tagIds)) {
|
||||||
// at least one tag missing, bail out
|
// at least one tag missing, bail out
|
||||||
$foundTagIds = array_map(
|
$foundTagIds = array_map(
|
||||||
function($tag) {
|
function(ISystemTag $tag) {
|
||||||
return $tag->getId();
|
return $tag->getId();
|
||||||
},
|
},
|
||||||
$tags
|
$tags
|
||||||
|
|
Loading…
Reference in New Issue