+ /**
+ * Find user ids by pseudonym
+ *
+ * @param array $pseudonym The pseudonym filter
+ * @return array The user ids
+ */
+ public function findIdByPseudonymAsArray(array $pseudonym): array {
+ //Set the request
+ $req =<<<SQL
+SELECT
+ a.id
+FROM (
+ SELECT
+ u.id
+ FROM RapsysAirBundle:User AS u
+ LEFT JOIN RapsysAirBundle:UserGroup AS gu ON (gu.user_id = u.id)
+ WHERE u.pseudonym IN (:pseudonym)
+ ORDER BY gu.group_id DESC, u.pseudonym ASC
+ LIMIT 0, :limit
+) AS a
+GROUP BY a.id
+ORDER BY NULL
+SQL;
+
+ //Replace bundle entity name by table name
+ $req = str_replace($this->tableKeys, $this->tableValues, $req);
+
+ //Get result set mapping instance
+ //XXX: DEBUG: see ../blog.orig/src/Rapsys/BlogBundle/Repository/ArticleRepository.php
+ $rsm = new ResultSetMapping();
+
+ //Declare all fields
+ //XXX: see vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php
+ //XXX: we don't use a result set as we want to translate group and civility
+ $rsm->addScalarResult('id', 'id', 'integer');
+
+ //Return result
+ return $this->_em
+ ->createNativeQuery($req, $rsm)
+ ->setParameter('pseudonym', $pseudonym)
+ //XXX: instead of array_column on the result
+ ->getResult(AbstractQuery::HYDRATE_SCALAR_COLUMN);
+ }
+