mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-05 23:03:11 +08:00
Allow custom API keys to be created
This commit is contained in:
@@ -6,6 +6,7 @@ namespace Shlinkio\Shlink\Rest\ApiKey\Repository;
|
||||
|
||||
use Doctrine\DBAL\LockMode;
|
||||
use Happyr\DoctrineSpecification\Repository\EntitySpecificationRepository;
|
||||
use Shlinkio\Shlink\Rest\ApiKey\Model\ApiKeyMeta;
|
||||
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||
|
||||
class ApiKeyRepository extends EntitySpecificationRepository implements ApiKeyRepositoryInterface
|
||||
@@ -24,7 +25,7 @@ class ApiKeyRepository extends EntitySpecificationRepository implements ApiKeyRe
|
||||
->getOneOrNullResult();
|
||||
|
||||
if ($firstResult === null) {
|
||||
$em->persist(ApiKey::fromKey($apiKey));
|
||||
$em->persist(ApiKey::fromMeta(ApiKeyMeta::fromParams(key: $apiKey)));
|
||||
$em->flush();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user