/**
* Store a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @param mixed $credentials
*/
$value = $this->crypto->encrypt(json_encode($credentials));
$this->dbConnection->setValues(self::DB_TABLE, [
- 'user' => $userId,
+ 'user' => (string)$userId,
'identifier' => $identifier,
], [
'credentials' => $value,
/**
* Retrieve a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return mixed
*/
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('credentials')
->from(self::DB_TABLE)
- ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId)))
+ ->where($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId)))
->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier)))
;
$result = $qb->execute()->fetch();
/**
* Delete a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return int rows removed
*/
public function delete($userId, $identifier) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete(self::DB_TABLE)
- ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId)))
+ ->where($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId)))
->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier)))
;
return $qb->execute();
/**
* Store a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @param mixed $credentials
* @since 8.2.0
/**
* Retrieve a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return mixed
* @since 8.2.0
/**
* Delete a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return int rows removed
* @since 8.2.0