instances added god may help
This commit is contained in:
@@ -6,7 +6,7 @@ use MintyPHP\DB;
|
||||
|
||||
class TenantMicrosoftAuthRepository
|
||||
{
|
||||
private static function unwrap($row): ?array
|
||||
private function unwrap($row): ?array
|
||||
{
|
||||
if (!$row || !is_array($row)) {
|
||||
return null;
|
||||
@@ -17,16 +17,16 @@ class TenantMicrosoftAuthRepository
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function findByTenantId(int $tenantId): ?array
|
||||
public function findByTenantId(int $tenantId): ?array
|
||||
{
|
||||
$row = DB::selectOne(
|
||||
'select id, tenant_id, enabled, enforce_microsoft_login, sync_profile_on_login, sync_profile_fields, entra_tenant_id, allowed_domains, use_shared_app, client_id_override, client_secret_override_enc, created, modified from tenant_auth_microsoft where tenant_id = ? limit 1',
|
||||
(string) $tenantId
|
||||
);
|
||||
return self::unwrap($row);
|
||||
return $this->unwrap($row);
|
||||
}
|
||||
|
||||
public static function listByTenantIds(array $tenantIds): array
|
||||
public function listByTenantIds(array $tenantIds): array
|
||||
{
|
||||
$tenantIds = array_values(array_unique(array_map('intval', $tenantIds)));
|
||||
$tenantIds = array_values(array_filter($tenantIds, static fn ($id) => $id > 0));
|
||||
@@ -46,7 +46,7 @@ class TenantMicrosoftAuthRepository
|
||||
|
||||
$result = [];
|
||||
foreach ($rows as $row) {
|
||||
$item = self::unwrap($row);
|
||||
$item = $this->unwrap($row);
|
||||
if (!is_array($item)) {
|
||||
continue;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class TenantMicrosoftAuthRepository
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function upsertByTenantId(int $tenantId, array $data): bool
|
||||
public function upsertByTenantId(int $tenantId, array $data): bool
|
||||
{
|
||||
$result = DB::update(
|
||||
'insert into tenant_auth_microsoft (tenant_id, enabled, enforce_microsoft_login, sync_profile_on_login, sync_profile_fields, entra_tenant_id, allowed_domains, use_shared_app, client_id_override, client_secret_override_enc, created) values (?,?,?,?,?,?,?,?,?,?,NOW()) ' .
|
||||
@@ -81,5 +81,4 @@ class TenantMicrosoftAuthRepository
|
||||
|
||||
return $result !== false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user