entityManager = $entityManager; } public function find(string $username, string $hash): ?User { /** @var ?User $user */ $user = $this->entityManager ->getRDBRepository(User::ENTITY_TYPE) ->where([ 'userName' => $username, 'password' => $hash, 'type!=' => ['api', 'system'], ]) ->findOne(); return $user; } public function findApiHmac(string $apiKey): ?User { /** @var ?User $user */ $user = $this->entityManager ->getRDBRepository(User::ENTITY_TYPE) ->where([ 'type' => 'api', 'apiKey' => $apiKey, 'authMethod' => 'Hmac', ]) ->findOne(); return $user; } public function findApiApiKey(string $apiKey): ?User { /** @var ?User $user */ $user = $this->entityManager ->getRDBRepository(User::ENTITY_TYPE) ->where([ 'type' => 'api', 'apiKey' => $apiKey, 'authMethod' => 'ApiKey', ]) ->findOne(); return $user; } }