+ * @return array The dances
+ */
+ public function findAllIndexed(): array {
+ //Set the request
+ $req = <<<SQL
+SELECT
+ d.id,
+ d.name,
+ d.type
+FROM RapsysAirBundle:Dance AS d
+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
+ //addScalarResult($sqlColName, $resColName, $type = 'string');
+ $rsm->addEntityResult('RapsysAirBundle:Dance', 'd')
+ ->addFieldResult('d', 'id', 'id')
+ ->addFieldResult('d', 'name', 'name')
+ ->addFieldResult('d', 'type', 'type')
+ ->addIndexByColumn('d', 'id');
+
+ //Return return
+ return $this->_em
+ ->createNativeQuery($req, $rsm)
+ ->getResult();
+ }
+
+ /**
+ * Find dance choices as array
+ *
+ * @return array The dance choices
+ */
+ public function findChoicesAsArray(): array {
+ //Set the request
+ $req = <<<SQL
+SELECT
+ d.name,
+ GROUP_CONCAT(d.id ORDER BY d.id SEPARATOR "\\n") AS ids,
+ GROUP_CONCAT(d.type ORDER BY d.id SEPARATOR "\\n") AS types
+FROM RapsysAirBundle:Dance AS d
+GROUP BY d.name
+ORDER BY d.name
+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
+ //addScalarResult($sqlColName, $resColName, $type = 'string');
+ $rsm->addScalarResult('name', 'name', 'string')
+ ->addScalarResult('ids', 'ids', 'string')
+ ->addScalarResult('types', 'types', 'string')
+ ->addIndexByScalar('name');
+
+ //Get result
+ $result = $this->_em
+ ->createNativeQuery($req, $rsm)
+ ->getArrayResult();
+
+ //Set return
+ $return = [];
+
+ //Iterate on each name
+ foreach($result as $name) {
+ //Set types
+ $types = [];
+
+ //Explode ids
+ $name['ids'] = explode("\n", $name['ids']);
+
+ //Explode types
+ $name['types'] = explode("\n", $name['types']);
+
+ //Iterate on each type
+ foreach($name['ids'] as $k => $id) {
+ //Add to types
+ $types[$this->translator->trans($name['types'][$k]).' ('.$id.')'] = intval($id);
+ }
+
+ //Add to return
+ $return[$this->translator->trans($name['name'])] = $types;
+ }
+
+ //Return return
+ return $return;
+ }
+
+ /**
+ * Find dances ids by nametype
+ *
+ * @param array $nametype The nametype filter
+ * @return array The dance ids