Standardized how inlined or regular specs are applied to query builders

This commit is contained in:
Alejandro Celaya
2022-01-18 20:06:32 +01:00
parent d39f3b4265
commit 9e9621e7b2
6 changed files with 61 additions and 59 deletions

View File

@@ -96,9 +96,15 @@ class ApiKey extends AbstractEntity
return $this->key;
}
public function spec(bool $inlined = false, ?string $context = null): Specification
public function spec(?string $context = null): Specification
{
$specs = $this->roles->map(fn (ApiKeyRole $role) => Role::toSpec($role, $inlined, $context))->getValues();
$specs = $this->roles->map(fn (ApiKeyRole $role) => Role::toSpec($role, $context))->getValues();
return Spec::andX(...$specs);
}
public function inlinedSpec(): Specification
{
$specs = $this->roles->map(fn (ApiKeyRole $role) => Role::toInlinedSpec($role))->getValues();
return Spec::andX(...$specs);
}