Removed methods to create tags and domains with lock, as they do not really lock as expected

This commit is contained in:
Alejandro Celaya
2021-05-23 08:21:40 +02:00
parent f82e103bc5
commit cd19876419
6 changed files with 8 additions and 43 deletions

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Repository;
use Doctrine\DBAL\LockMode;
use Happyr\DoctrineSpecification\Repository\EntitySpecificationRepository;
use Happyr\DoctrineSpecification\Spec;
use Shlinkio\Shlink\Core\Entity\Tag;
@@ -63,16 +62,4 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
return $result > 0;
}
public function findOneByNameWithLock(string $name): ?Tag
{
$qb = $this->createQueryBuilder('t');
$qb->where($qb->expr()->eq('t.name', ':name'))
->setParameter('name', $name)
->setMaxResults(1);
$query = $qb->getQuery()->setLockMode(LockMode::PESSIMISTIC_WRITE);
return $query->getOneOrNullResult();
}
}

View File

@@ -6,7 +6,6 @@ namespace Shlinkio\Shlink\Core\Repository;
use Doctrine\Persistence\ObjectRepository;
use Happyr\DoctrineSpecification\Repository\EntitySpecificationRepositoryInterface;
use Shlinkio\Shlink\Core\Entity\Tag;
use Shlinkio\Shlink\Core\Tag\Model\TagInfo;
use Shlinkio\Shlink\Rest\Entity\ApiKey;
@@ -20,6 +19,4 @@ interface TagRepositoryInterface extends ObjectRepository, EntitySpecificationRe
public function findTagsWithInfo(?ApiKey $apiKey = null): array;
public function tagExists(string $tag, ?ApiKey $apiKey = null): bool;
public function findOneByNameWithLock(string $name): ?Tag;
}