mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Added db test for VisitRepository::countVisits
This commit is contained in:
@@ -24,19 +24,25 @@ class ApiKey extends AbstractEntity
|
||||
private Collection $roles;
|
||||
|
||||
/**
|
||||
* @param RoleDefinition[] $roleDefinitions
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(?Chronos $expirationDate = null, array $roleDefinitions = [])
|
||||
public function __construct(?Chronos $expirationDate = null)
|
||||
{
|
||||
$this->key = Uuid::uuid4()->toString();
|
||||
$this->expirationDate = $expirationDate;
|
||||
$this->enabled = true;
|
||||
$this->roles = new ArrayCollection();
|
||||
}
|
||||
|
||||
public static function withRoles(RoleDefinition ...$roleDefinitions): self
|
||||
{
|
||||
$apiKey = new self();
|
||||
|
||||
foreach ($roleDefinitions as $roleDefinition) {
|
||||
$this->registerRole($roleDefinition);
|
||||
$apiKey->registerRole($roleDefinition);
|
||||
}
|
||||
|
||||
return $apiKey;
|
||||
}
|
||||
|
||||
public function getExpirationDate(): ?Chronos
|
||||
|
||||
Reference in New Issue
Block a user