From 667144adfd04339a9e6b11d28be571e24f10855c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Agneray?= <francois.agneray@lam.fr>
Date: Thu, 28 Apr 2022 14:49:23 +0200
Subject: [PATCH] Refactor server (code improvement)

---
 server/app/routes.php                         |  2 +-
 server/src/Action/AbstractAction.php          | 11 ---
 server/src/Action/AdminFileExplorerAction.php |  3 +-
 server/src/Action/AttributeAction.php         | 46 +++++++++
 server/src/Action/AttributeDistinctAction.php |  5 +-
 server/src/Action/AttributeListAction.php     | 98 +++++++++++--------
 server/src/Action/ClientSettingsAction.php    |  4 +-
 server/src/Action/ColumnListAction.php        |  2 +-
 server/src/Action/ConeSearchConfigAction.php  | 10 +-
 server/src/Action/CriteriaFamilyAction.php    |  2 +-
 .../src/Action/CriteriaFamilyListAction.php   |  2 +-
 server/src/Action/DatabaseAction.php          |  2 +-
 server/src/Action/DatabaseListAction.php      |  3 +-
 server/src/Action/DatasetAction.php           |  9 +-
 server/src/Action/DatasetFamilyAction.php     |  2 +-
 server/src/Action/DatasetFamilyListAction.php |  2 +-
 .../src/Action/DatasetFileExplorerAction.php  |  2 +-
 server/src/Action/DatasetGroupAction.php      |  6 +-
 server/src/Action/DatasetGroupListAction.php  |  2 +-
 server/src/Action/DatasetListAction.php       | 11 ++-
 server/src/Action/DownloadArchiveAction.php   |  2 +-
 server/src/Action/ImageAction.php             |  2 +-
 server/src/Action/ImageListAction.php         |  2 +-
 server/src/Action/InstanceAction.php          | 33 ++++++-
 .../src/Action/InstanceFileExplorerAction.php |  2 +-
 server/src/Action/InstanceGroupAction.php     | 12 +--
 server/src/Action/InstanceGroupListAction.php | 12 +--
 server/src/Action/InstanceListAction.php      | 35 ++++++-
 .../src/Action/IsArchiveAvailableAction.php   |  2 +-
 server/src/Action/OptionAction.php            | 12 +--
 server/src/Action/OptionListAction.php        |  2 +-
 server/src/Action/OutputCategoryAction.php    |  2 +-
 .../src/Action/OutputCategoryListAction.php   |  2 +-
 server/src/Action/OutputFamilyAction.php      |  2 +-
 server/src/Action/OutputFamilyListAction.php  |  6 +-
 server/src/Action/RootAction.php              |  2 -
 server/src/Action/SearchAction.php            |  2 -
 server/src/Action/SelectAction.php            | 12 +--
 server/src/Action/SelectListAction.php        |  2 +-
 server/src/Action/TableListAction.php         |  2 +-
 .../Search/Query/Operator/JsonPostgres.php    | 32 ++++++
 .../Search/Query/Operator/OperatorNotNull.php |  2 -
 server/src/Search/Response/TextResponse.php   |  4 +-
 .../src/Search/Response/VotableResponse.php   |  4 +-
 server/tests/Action/AttributeActionTest.php   | 14 ++-
 .../Action/AttributeDistinctActionTest.php    |  4 +-
 .../tests/Action/AttributeListActionTest.php  | 32 ++++--
 server/tests/Action/ColumnListActionTest.php  |  2 +-
 server/tests/Action/TableListActionTest.php   |  2 +-
 .../Search/Response/TextResponseTest.php      |  4 +-
 50 files changed, 318 insertions(+), 154 deletions(-)

diff --git a/server/app/routes.php b/server/app/routes.php
index de183b61..928ca2f7 100644
--- a/server/app/routes.php
+++ b/server/app/routes.php
@@ -15,7 +15,7 @@ use Slim\Routing\RouteCollectorProxy;
 $app->get('/', App\Action\RootAction::class);
 $app->get('/client-settings', App\Action\ClientSettingsAction::class);
 
-// Metamodel actions
+// Metamodel actions (ANIS admin only)
 $app->group('', function (RouteCollectorProxy $group) {
     $group->map([OPTIONS, GET, POST], '/select', App\Action\SelectListAction::class);
     $group->map([OPTIONS, GET, PUT, DELETE], '/select/{name}', App\Action\SelectAction::class);
diff --git a/server/src/Action/AbstractAction.php b/server/src/Action/AbstractAction.php
index d10add52..1a2c8066 100644
--- a/server/src/Action/AbstractAction.php
+++ b/server/src/Action/AbstractAction.php
@@ -40,17 +40,6 @@ abstract class AbstractAction
         $this->em = $em;
     }
 
-    /**
-     * @param string $field
-     * @param array  $parsedBody
-     *
-     * @return string true if field is empty or false else
-     */
-    protected function isEmptyField(string $field, array $parsedBody): bool
-    {
-        return !isset($parsedBody[$field]);
-    }
-
     /**
      * @param ServerRequestInterface $request     PSR-7 This object represents the HTTP request
      * @param string                 $datasetName
diff --git a/server/src/Action/AdminFileExplorerAction.php b/server/src/Action/AdminFileExplorerAction.php
index d3100f8e..0ed09103 100644
--- a/server/src/Action/AdminFileExplorerAction.php
+++ b/server/src/Action/AdminFileExplorerAction.php
@@ -24,7 +24,7 @@ use Nyholm\Psr7\Factory\Psr17Factory;
 final class AdminFileExplorerAction
 {
     /**
-     * Contains anis-server data path
+     * Contains ANIS data path value
      *
      * @var string
      */
@@ -80,6 +80,7 @@ final class AdminFileExplorerAction
                 ->withHeader('Content-Type', mime_content_type($path))
                 ->withHeader('Content-Length', filesize($path));
         } else {
+            // Else return the list of files in the path
             $files = array();
 
             foreach (scandir($path) as $file) {
diff --git a/server/src/Action/AttributeAction.php b/server/src/Action/AttributeAction.php
index 92337444..571911cc 100644
--- a/server/src/Action/AttributeAction.php
+++ b/server/src/Action/AttributeAction.php
@@ -15,6 +15,7 @@ namespace App\Action;
 use Psr\Http\Message\ServerRequestInterface;
 use Psr\Http\Message\ResponseInterface;
 use Slim\Exception\HttpNotFoundException;
+use Slim\Exception\HttpBadRequestException;
 use App\Entity\Attribute;
 
 /**
@@ -60,6 +61,51 @@ final class AttributeAction extends AbstractAction
 
         if ($request->getMethod() === PUT) {
             $parsedBody = $request->getParsedBody();
+
+            $fields = array(
+                'id',
+                'name',
+                'label',
+                'form_label',
+                'description',
+                'primary_key',
+                'type',
+                'search_type',
+                'operator',
+                'min',
+                'max',
+                'options',
+                'placeholder_min',
+                'placeholder_max',
+                'criteria_display',
+                'output_display',
+                'selected',
+                'renderer',
+                'renderer_config',
+                'order_by',
+                'archive',
+                'detail',
+                'display_detail',
+                'renderer_detail',
+                'renderer_detail_config',
+                'vo_utype',
+                'vo_ucd',
+                'vo_unit',
+                'vo_description',
+                'vo_datatype',
+                'vo_size',
+                'id_criteria_family',
+                'id_output_category'
+            );
+            foreach ($fields as $a) {
+                if (!array_key_exists($a, $parsedBody)) {
+                    throw new HttpBadRequestException(
+                        $request,
+                        'Param ' . $a . ' needed to edit the attribute'
+                    );
+                }
+            }
+
             $this->editAttribute($attribute, $parsedBody);
             $payload = json_encode($attribute);
         }
diff --git a/server/src/Action/AttributeDistinctAction.php b/server/src/Action/AttributeDistinctAction.php
index 139e8ae7..3f54a472 100644
--- a/server/src/Action/AttributeDistinctAction.php
+++ b/server/src/Action/AttributeDistinctAction.php
@@ -17,7 +17,6 @@ use Psr\Http\Message\ResponseInterface;
 use Slim\Exception\HttpNotFoundException;
 use Doctrine\ORM\EntityManagerInterface;
 use App\Search\DBALConnectionFactory;
-use PDO;
 
 /**
  * @author François Agneray <francois.agneray@lam.fr>
@@ -85,8 +84,8 @@ final class AttributeDistinctAction extends AbstractAction
             $queryBuilder->orderBy($column);
 
             // Execute query and returns response
-            $stmt = $queryBuilder->execute();
-            $rows = $stmt->fetchAll(PDO::FETCH_COLUMN);
+            $stmt = $queryBuilder->executeQuery();
+            $rows = $stmt->fetchFirstColumn();
             $payload = json_encode($rows);
         }
 
diff --git a/server/src/Action/AttributeListAction.php b/server/src/Action/AttributeListAction.php
index d183968f..7bd148c6 100644
--- a/server/src/Action/AttributeListAction.php
+++ b/server/src/Action/AttributeListAction.php
@@ -69,13 +69,38 @@ final class AttributeListAction extends AbstractAction
                 'name',
                 'label',
                 'form_label',
+                'description',
+                'primary_key',
                 'type',
+                'search_type',
+                'operator',
+                'min',
+                'max',
+                'options',
+                'placeholder_min',
+                'placeholder_max',
                 'criteria_display',
                 'output_display',
+                'selected',
+                'renderer',
+                'renderer_config',
+                'order_by',
+                'archive',
+                'detail',
                 'display_detail',
+                'renderer_detail',
+                'renderer_detail_config',
+                'vo_utype',
+                'vo_ucd',
+                'vo_unit',
+                'vo_description',
+                'vo_datatype',
+                'vo_size',
+                'id_criteria_family',
+                'id_output_category'
             );
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new attribute'
@@ -102,38 +127,38 @@ final class AttributeListAction extends AbstractAction
      */
     private function postAttribute(array $parsedBody, Dataset $dataset): Attribute
     {
-        $attribute = new Attribute($this->getValue($parsedBody, 'id'), $dataset);
-        $attribute->setName($this->getValue($parsedBody, 'name'));
-        $attribute->setLabel($this->getValue($parsedBody, 'label'));
-        $attribute->setFormLabel($this->getValue($parsedBody, 'form_label'));
-        $attribute->setDescription($this->getValue($parsedBody, 'description'));
+        $attribute = new Attribute($parsedBody['id'], $dataset);
+        $attribute->setName($parsedBody['name']);
+        $attribute->setLabel($parsedBody['label']);
+        $attribute->setFormLabel($parsedBody['form_label']);
+        $attribute->setDescription($parsedBody['description']);
         $attribute->setPrimaryKey($parsedBody['primary_key']);
-        $attribute->setType($this->getValue($parsedBody, 'type'));
-        $attribute->setSearchType($this->getValue($parsedBody, 'search_type'));
-        $attribute->setOperator($this->getValue($parsedBody, 'operator'));
-        $attribute->setMin($this->getValue($parsedBody, 'min'));
-        $attribute->setMax($this->getValue($parsedBody, 'max'));
-        $attribute->setOptions($this->getValue($parsedBody, 'options'));
-        $attribute->setPlaceholderMin($this->getValue($parsedBody, 'placeholder_min'));
-        $attribute->setPlaceholderMax($this->getValue($parsedBody, 'placeholder_max'));
-        $attribute->setCriteriaDisplay($this->getValue($parsedBody, 'criteria_display'));
-        $attribute->setOutputDisplay($this->getValue($parsedBody, 'output_display'));
-        $attribute->setSelected($this->getValue($parsedBody, 'selected'));
-        $attribute->setRenderer($this->getValue($parsedBody, 'renderer'));
-        $attribute->setRendererConfig($this->getValue($parsedBody, 'renderer_config'));
-        $attribute->setOrderBy($this->getValue($parsedBody, 'order_by'));
+        $attribute->setType($parsedBody['type']);
+        $attribute->setSearchType($parsedBody['search_type']);
+        $attribute->setOperator($parsedBody['operator']);
+        $attribute->setMin($parsedBody['min']);
+        $attribute->setMax($parsedBody['max']);
+        $attribute->setOptions($parsedBody['options']);
+        $attribute->setPlaceholderMin($parsedBody['placeholder_min']);
+        $attribute->setPlaceholderMax($parsedBody['placeholder_max']);
+        $attribute->setCriteriaDisplay($parsedBody['criteria_display']);
+        $attribute->setOutputDisplay($parsedBody['output_display']);
+        $attribute->setSelected($parsedBody['selected']);
+        $attribute->setRenderer($parsedBody['renderer']);
+        $attribute->setRendererConfig($parsedBody['renderer_config']);
+        $attribute->setOrderBy($parsedBody['order_by']);
         $attribute->setArchive($parsedBody['archive']);
-        $attribute->setDetail($this->getValue($parsedBody, 'detail'));
-        $attribute->setDisplayDetail($this->getValue($parsedBody, 'display_detail'));
-        $attribute->setRendererDetail($this->getValue($parsedBody, 'renderer_detail'));
-        $attribute->setRendererDetailConfig($this->getValue($parsedBody, 'renderer_detail_config'));
-        $attribute->setVoUtype($this->getValue($parsedBody, 'vo_utype'));
-        $attribute->setVoUcd($this->getValue($parsedBody, 'vo_ucd'));
-        $attribute->setVoUnit($this->getValue($parsedBody, 'vo_unit'));
-        $attribute->setVoDescription($this->getValue($parsedBody, 'vo_description'));
-        $attribute->setVoDatatype($this->getValue($parsedBody, 'vo_datatype'));
-        $attribute->setVoSize($this->getValue($parsedBody, 'vo_size'));
-        if (is_null($this->getValue($parsedBody, 'id_criteria_family'))) {
+        $attribute->setDetail($parsedBody['detail']);
+        $attribute->setDisplayDetail($parsedBody['display_detail']);
+        $attribute->setRendererDetail($parsedBody['renderer_detail']);
+        $attribute->setRendererDetailConfig($parsedBody['renderer_detail_config']);
+        $attribute->setVoUtype($parsedBody['vo_utype']);
+        $attribute->setVoUcd($parsedBody['vo_ucd']);
+        $attribute->setVoUnit($parsedBody['vo_unit']);
+        $attribute->setVoDescription($parsedBody['vo_description']);
+        $attribute->setVoDatatype($parsedBody['vo_datatype']);
+        $attribute->setVoSize($parsedBody['vo_size']);
+        if (is_null($parsedBody['id_criteria_family'])) {
             $criteriaFamily = null;
         } else {
             $criteriaFamily = $this->em->find(
@@ -142,7 +167,7 @@ final class AttributeListAction extends AbstractAction
             );
         }
         $attribute->setCriteriaFamily($criteriaFamily);
-        if (is_null($this->getValue($parsedBody, 'id_output_category'))) {
+        if (is_null($parsedBody['id_output_category'])) {
             $outputCategory = null;
         } else {
             $outputCategory = $this->em->find(
@@ -157,13 +182,4 @@ final class AttributeListAction extends AbstractAction
 
         return $attribute;
     }
-
-    private function getValue($parsedBody, $key)
-    {
-        if (array_key_exists($key, $parsedBody)) {
-            return $parsedBody[$key];
-        } else {
-            return null;
-        }
-    }
 }
diff --git a/server/src/Action/ClientSettingsAction.php b/server/src/Action/ClientSettingsAction.php
index 9ccc6f48..67898eb3 100644
--- a/server/src/Action/ClientSettingsAction.php
+++ b/server/src/Action/ClientSettingsAction.php
@@ -16,8 +16,6 @@ use Psr\Http\Message\ServerRequestInterface;
 use Psr\Http\Message\ResponseInterface;
 
 /**
- * Client settings action
- *
  * @author François Agneray <francois.agneray@lam.fr>
  * @package App\Action
  */
@@ -36,7 +34,7 @@ final class ClientSettingsAction
     }
 
     /**
-     * This action indicates that the service is responding
+     * This action returns the ANIS settings needed to start the web client
      *
      * @param  ServerRequestInterface $request  PSR-7 This object represents the HTTP request
      * @param  ResponseInterface      $response PSR-7 This object represents the HTTP response
diff --git a/server/src/Action/ColumnListAction.php b/server/src/Action/ColumnListAction.php
index d5ca8b61..4ac25d6b 100644
--- a/server/src/Action/ColumnListAction.php
+++ b/server/src/Action/ColumnListAction.php
@@ -73,7 +73,7 @@ final class ColumnListAction extends AbstractAction
         if ($request->getMethod() === GET) {
             $database = $dataset->getDatabase();
             $connection = $this->connectionFactory->create($database);
-            $sm = $connection->getSchemaManager();
+            $sm = $connection->createSchemaManager();
             $columns = $this->getColumns($sm, $dataset->getTableRef());
             $payload = json_encode($columns);
         }
diff --git a/server/src/Action/ConeSearchConfigAction.php b/server/src/Action/ConeSearchConfigAction.php
index 4a041603..8d2be835 100644
--- a/server/src/Action/ConeSearchConfigAction.php
+++ b/server/src/Action/ConeSearchConfigAction.php
@@ -113,7 +113,7 @@ final class ConeSearchConfigAction extends AbstractAction
 
         // To work this actions needs information
         foreach ($fields as $a) {
-            if ($this->isEmptyField($a, $parsedBody)) {
+            if (!array_key_exists($a, $parsedBody)) {
                 throw new HttpBadRequestException(
                     $request,
                     'Param ' . $a . ' needed to add a edit cone-search configuration'
@@ -123,8 +123,8 @@ final class ConeSearchConfigAction extends AbstractAction
     }
 
     /**
-     * @param array    $parsedBody  Contains the values ​​of the new cone-search configuration sent by the user
-     * @param Dataset  $dataset     Dataset for adding the cone-search configuration
+     * @param array   $parsedBody Contains the values ​​of the new cone-search configuration sent by the user
+     * @param Dataset $dataset    Dataset for adding the cone-search configuration
      *
      * @return ConeSearchConfig
      */
@@ -148,8 +148,8 @@ final class ConeSearchConfigAction extends AbstractAction
     /**
      * Update cone-search configuration object with setters
      *
-     * @param ConeSearchConfig  $coneSearchConfig   The cone-search configuration to update
-     * @param string[]          $parsedBody         Contains the new values ​​of the cone-search sent by the user
+     * @param ConeSearchConfig $coneSearchConfig The cone-search configuration to update
+     * @param string[]         $parsedBody       Contains the new values ​​of the cone-search sent by the user
      */
     private function editConeSearchConfig(coneSearchConfig $coneSearchConfig, array $parsedBody): void
     {
diff --git a/server/src/Action/CriteriaFamilyAction.php b/server/src/Action/CriteriaFamilyAction.php
index 3a6e15eb..a65b201b 100644
--- a/server/src/Action/CriteriaFamilyAction.php
+++ b/server/src/Action/CriteriaFamilyAction.php
@@ -64,7 +64,7 @@ final class CriteriaFamilyAction extends AbstractAction
 
             $fields = array('label', 'display', 'opened');
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the criteria family'
diff --git a/server/src/Action/CriteriaFamilyListAction.php b/server/src/Action/CriteriaFamilyListAction.php
index f5652c95..7aa7c402 100644
--- a/server/src/Action/CriteriaFamilyListAction.php
+++ b/server/src/Action/CriteriaFamilyListAction.php
@@ -67,7 +67,7 @@ final class CriteriaFamilyListAction extends AbstractAction
 
             // To work this action needs information
             foreach (array('label', 'display', 'opened') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new criteria family'
diff --git a/server/src/Action/DatabaseAction.php b/server/src/Action/DatabaseAction.php
index 11a7318b..8e2128ff 100644
--- a/server/src/Action/DatabaseAction.php
+++ b/server/src/Action/DatabaseAction.php
@@ -64,7 +64,7 @@ final class DatabaseAction extends AbstractAction
 
             // If mandatories empty fields 400
             foreach (array('label', 'dbname', 'dbtype', 'dbhost', 'dbport', 'dblogin', 'dbpassword') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the database'
diff --git a/server/src/Action/DatabaseListAction.php b/server/src/Action/DatabaseListAction.php
index 43231f2c..d033c5ac 100644
--- a/server/src/Action/DatabaseListAction.php
+++ b/server/src/Action/DatabaseListAction.php
@@ -43,7 +43,6 @@ final class DatabaseListAction extends AbstractAction
         }
 
         if ($request->getMethod() === GET) {
-            // Retrieve user with email adress
             $databases = $this->em->getRepository('App\Entity\Database')->findBy(
                 array(),
                 array('id' => 'ASC')
@@ -56,7 +55,7 @@ final class DatabaseListAction extends AbstractAction
 
             // To work this action needs user information to update
             foreach (array('label', 'dbname', 'dbtype', 'dbhost', 'dbport', 'dblogin', 'dbpassword') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new database'
diff --git a/server/src/Action/DatasetAction.php b/server/src/Action/DatasetAction.php
index e5dfd5d2..6f3b3a4b 100644
--- a/server/src/Action/DatasetAction.php
+++ b/server/src/Action/DatasetAction.php
@@ -70,10 +70,17 @@ final class DatasetAction extends AbstractAction
                 'display',
                 'data_path',
                 'public',
+                'download_json',
+                'download_csv',
+                'download_ascii',
+                'download_vo',
+                'server_link_enabled',
+                'datatable_enabled',
+                'datatable_selectable_rows',
                 'id_dataset_family'
             );
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the dataset'
diff --git a/server/src/Action/DatasetFamilyAction.php b/server/src/Action/DatasetFamilyAction.php
index b1203095..a81c3cf0 100644
--- a/server/src/Action/DatasetFamilyAction.php
+++ b/server/src/Action/DatasetFamilyAction.php
@@ -64,7 +64,7 @@ final class DatasetFamilyAction extends AbstractAction
 
             $fields = array('label', 'display', 'opened');
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the dataset family'
diff --git a/server/src/Action/DatasetFamilyListAction.php b/server/src/Action/DatasetFamilyListAction.php
index ac21f393..28476956 100644
--- a/server/src/Action/DatasetFamilyListAction.php
+++ b/server/src/Action/DatasetFamilyListAction.php
@@ -64,7 +64,7 @@ final class DatasetFamilyListAction extends AbstractAction
 
             // To work this action needs information
             foreach (array('label', 'display', 'opened') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new dataset family'
diff --git a/server/src/Action/DatasetFileExplorerAction.php b/server/src/Action/DatasetFileExplorerAction.php
index 84dabe47..ce6ba552 100644
--- a/server/src/Action/DatasetFileExplorerAction.php
+++ b/server/src/Action/DatasetFileExplorerAction.php
@@ -25,7 +25,7 @@ use Nyholm\Psr7\Factory\Psr17Factory;
 final class DatasetFileExplorerAction extends AbstractAction
 {
     /**
-     * Contains anis-server data path
+     * Contains ANIS data path value
      *
      * @var string
      */
diff --git a/server/src/Action/DatasetGroupAction.php b/server/src/Action/DatasetGroupAction.php
index 637c7cd8..d97f5d02 100644
--- a/server/src/Action/DatasetGroupAction.php
+++ b/server/src/Action/DatasetGroupAction.php
@@ -64,7 +64,7 @@ final class DatasetGroupAction extends AbstractAction
 
             // If mandatories empty fields 400
             foreach (array('role', 'datasets') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the dataset group'
@@ -88,10 +88,10 @@ final class DatasetGroupAction extends AbstractAction
     }
 
     /**
-     * Update group object with setters
+     * Update dataset group object with setters
      *
      * @param DatasetGroup $group      The dataset group to update
-     * @param array        $parsedBody Contains the new values ​​of the group sent by the user
+     * @param array        $parsedBody Contains the new values ​​of the dataset group sent by the user
      */
     private function editGroup(DatasetGroup $group, array $parsedBody): void
     {
diff --git a/server/src/Action/DatasetGroupListAction.php b/server/src/Action/DatasetGroupListAction.php
index c7db3d8d..f06976b5 100644
--- a/server/src/Action/DatasetGroupListAction.php
+++ b/server/src/Action/DatasetGroupListAction.php
@@ -68,7 +68,7 @@ final class DatasetGroupListAction extends AbstractAction
 
             // To work this action needs group information
             foreach (array('role', 'datasets') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new dataset group'
diff --git a/server/src/Action/DatasetListAction.php b/server/src/Action/DatasetListAction.php
index ba8b7fd8..2e9bba17 100644
--- a/server/src/Action/DatasetListAction.php
+++ b/server/src/Action/DatasetListAction.php
@@ -74,10 +74,17 @@ final class DatasetListAction extends AbstractAction
                 'display',
                 'data_path',
                 'public',
+                'download_json',
+                'download_csv',
+                'download_ascii',
+                'download_vo',
+                'server_link_enabled',
+                'datatable_enabled',
+                'datatable_selectable_rows',
                 'id_database'
             );
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new dataset'
@@ -105,7 +112,7 @@ final class DatasetListAction extends AbstractAction
     }
 
     /**
-     * Create a new dataset doctrine object and save it
+     * Add a new dataset into the metamodel
      *
      * @param array         $parsedBody    Contains the values ​​of the new dataset sent by the user
      * @param Database      $database      Contains the database doctrine object
diff --git a/server/src/Action/DownloadArchiveAction.php b/server/src/Action/DownloadArchiveAction.php
index 68920a8b..10066ad4 100644
--- a/server/src/Action/DownloadArchiveAction.php
+++ b/server/src/Action/DownloadArchiveAction.php
@@ -25,7 +25,7 @@ use Nyholm\Psr7\Factory\Psr17Factory;
 final class DownloadArchiveAction extends AbstractAction
 {
     /**
-     * Contains anis-server data path
+     * Contains ANIS data path value
      *
      * @var string
      */
diff --git a/server/src/Action/ImageAction.php b/server/src/Action/ImageAction.php
index 67e0376f..a9c2034e 100644
--- a/server/src/Action/ImageAction.php
+++ b/server/src/Action/ImageAction.php
@@ -76,7 +76,7 @@ final class ImageAction extends AbstractAction
             );
 
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the image'
diff --git a/server/src/Action/ImageListAction.php b/server/src/Action/ImageListAction.php
index 9123ca00..3857fd82 100644
--- a/server/src/Action/ImageListAction.php
+++ b/server/src/Action/ImageListAction.php
@@ -80,7 +80,7 @@ final class ImageListAction extends AbstractAction
 
             // To work this action needs information
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new image'
diff --git a/server/src/Action/InstanceAction.php b/server/src/Action/InstanceAction.php
index 52593f04..658c17e5 100644
--- a/server/src/Action/InstanceAction.php
+++ b/server/src/Action/InstanceAction.php
@@ -62,9 +62,38 @@ final class InstanceAction extends AbstractAction
         if ($request->getMethod() === PUT) {
             $parsedBody = $request->getParsedBody();
 
+            // To work this action needs information to update instance
+            $fields = array(
+                'label',
+                'description',
+                'scientific_manager',
+                'instrument',
+                'wavelength_domain',
+                'display',
+                'data_path',
+                'files_path',
+                'public',
+                'portal_logo',
+                'design_color',
+                'design_background_color',
+                'design_logo',
+                'design_favicon',
+                'home_component',
+                'home_component_config',
+                'samp_enabled',
+                'back_to_portal',
+                'search_by_criteria_allowed',
+                'search_by_criteria_label',
+                'search_multiple_allowed',
+                'search_multiple_label',
+                'search_multiple_all_datasets_selected',
+                'documentation_allowed',
+                'documentation_label'
+            );
+
             // If mandatories empty fields 400
-            foreach (array('label') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+            foreach ($fields as $a) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the instance'
diff --git a/server/src/Action/InstanceFileExplorerAction.php b/server/src/Action/InstanceFileExplorerAction.php
index f613a420..d68d030d 100644
--- a/server/src/Action/InstanceFileExplorerAction.php
+++ b/server/src/Action/InstanceFileExplorerAction.php
@@ -25,7 +25,7 @@ use Nyholm\Psr7\Factory\Psr17Factory;
 final class InstanceFileExplorerAction extends AbstractAction
 {
     /**
-     * Contains anis-server data path
+     * Contains ANIS data path value
      *
      * @var string
      */
diff --git a/server/src/Action/InstanceGroupAction.php b/server/src/Action/InstanceGroupAction.php
index ae7d2688..2d4ddee1 100644
--- a/server/src/Action/InstanceGroupAction.php
+++ b/server/src/Action/InstanceGroupAction.php
@@ -26,9 +26,9 @@ use App\Entity\Instance;
 final class InstanceGroupAction extends AbstractAction
 {
     /**
-     * `GET` Returns the InstanceGroup found
-     * `PUT` Full update the InstanceGroup and returns the new version
-     * `DELETE` Delete the InstanceGroup found and return a confirmation message
+     * `GET` Returns the instance group found
+     * `PUT` Full update the instance group and returns the new version
+     * `DELETE` Delete the instance group found and return a confirmation message
      *
      * @param  ServerRequestInterface $request  PSR-7 This object represents the HTTP request
      * @param  ResponseInterface      $response PSR-7 This object represents the HTTP response
@@ -45,7 +45,7 @@ final class InstanceGroupAction extends AbstractAction
             return $response->withHeader('Access-Control-Allow-Methods', 'GET, PUT, DELETE, OPTIONS');
         }
 
-        // Search the correct instance-group with primary key
+        // Search the correct instance group with primary key
         $instanceGroup = $this->em->find('App\Entity\InstanceGroup', $args['id']);
 
         // If group is not found 404
@@ -65,7 +65,7 @@ final class InstanceGroupAction extends AbstractAction
 
             // If mandatories empty fields 400
             foreach (array('role', 'instances') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the instance-group'
@@ -89,7 +89,7 @@ final class InstanceGroupAction extends AbstractAction
     }
 
     /**
-     * Update instance-group object with setters
+     * Update instance group object with setters
      *
      * @param InstanceGroup $instanceGroup The instance-group to update
      * @param array         $parsedBody    Contains the new values ​​of the instance-group sent by the user
diff --git a/server/src/Action/InstanceGroupListAction.php b/server/src/Action/InstanceGroupListAction.php
index ae7760ff..92be4f5b 100644
--- a/server/src/Action/InstanceGroupListAction.php
+++ b/server/src/Action/InstanceGroupListAction.php
@@ -25,8 +25,8 @@ use App\Entity\Instance;
 final class InstanceGroupListAction extends AbstractAction
 {
     /**
-     * `GET`  Returns a list of all instance-groups listed in the metamodel database
-     * `POST` Add a new instance-group
+     * `GET`  Returns a list of all instance groups listed in the metamodel database
+     * `POST` Add a new instance group
      *
      * @param  ServerRequestInterface $request  PSR-7 This object represents the HTTP request
      * @param  ResponseInterface      $response PSR-7 This object represents the HTTP response
@@ -53,7 +53,7 @@ final class InstanceGroupListAction extends AbstractAction
 
             // To work this action needs instance-group information
             foreach (array('role', 'instances') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new instance-group'
@@ -71,11 +71,11 @@ final class InstanceGroupListAction extends AbstractAction
     }
 
     /**
-     * Add a new instance-group into the metamodel
+     * Add a new instance group into the metamodel
      *
-     * @param array    $parsedBody Contains the values ​​of the new instance-group sent by the user
+     * @param array $parsedBody Contains the values ​​of the new instance-group sent by the user
      *
-     * @return InstanceGroup The newly created instance-group
+     * @return InstanceGroup The newly created instance group
      */
     private function postInstanceGroup(array $parsedBody): InstanceGroup
     {
diff --git a/server/src/Action/InstanceListAction.php b/server/src/Action/InstanceListAction.php
index f27cb9d5..2cf086ed 100644
--- a/server/src/Action/InstanceListAction.php
+++ b/server/src/Action/InstanceListAction.php
@@ -61,9 +61,38 @@ final class InstanceListAction extends AbstractAction
         if ($request->getMethod() === POST) {
             $parsedBody = $request->getParsedBody();
 
-            // To work this action needs user information to update
-            foreach (array('name', 'label') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+            // To work this action needs information to add a new instance
+            $fields = array(
+                'name',
+                'label',
+                'description',
+                'scientific_manager',
+                'instrument',
+                'wavelength_domain',
+                'display',
+                'data_path',
+                'files_path',
+                'public',
+                'portal_logo',
+                'design_color',
+                'design_background_color',
+                'design_logo',
+                'design_favicon',
+                'home_component',
+                'home_component_config',
+                'samp_enabled',
+                'back_to_portal',
+                'search_by_criteria_allowed',
+                'search_by_criteria_label',
+                'search_multiple_allowed',
+                'search_multiple_label',
+                'search_multiple_all_datasets_selected',
+                'documentation_allowed',
+                'documentation_label'
+            );
+
+            foreach ($fields as $a) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new instance'
diff --git a/server/src/Action/IsArchiveAvailableAction.php b/server/src/Action/IsArchiveAvailableAction.php
index f1e71dc6..a6d82cf9 100644
--- a/server/src/Action/IsArchiveAvailableAction.php
+++ b/server/src/Action/IsArchiveAvailableAction.php
@@ -23,7 +23,7 @@ use Doctrine\ORM\EntityManagerInterface;
 final class IsArchiveAvailableAction extends AbstractAction
 {
     /**
-     * Contains anis-server data path
+     * Contains ANIS data path value
      *
      * @var string
      */
diff --git a/server/src/Action/OptionAction.php b/server/src/Action/OptionAction.php
index dfebb1bc..06a9b37b 100644
--- a/server/src/Action/OptionAction.php
+++ b/server/src/Action/OptionAction.php
@@ -64,7 +64,7 @@ final class OptionAction extends AbstractAction
 
             // If mandatories empty fields 400
             foreach (array('label', 'value', 'display') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the option'
@@ -88,11 +88,11 @@ final class OptionAction extends AbstractAction
     }
 
     /**
-    * Update option object with setters
-    *
-    * @param Option $option     The option object to update
-    * @param array  $parsedBody Contains the new values ​​of the option sent by the user
-    */
+     * Update option object with setters
+     *
+     * @param Option $option     The option object to update
+     * @param array  $parsedBody Contains the new values ​​of the option sent by the user
+     */
     private function editOption(Option $option, array $parsedBody): void
     {
         $option->setLabel($parsedBody['label']);
diff --git a/server/src/Action/OptionListAction.php b/server/src/Action/OptionListAction.php
index 5a91b0dd..fb5c1328 100644
--- a/server/src/Action/OptionListAction.php
+++ b/server/src/Action/OptionListAction.php
@@ -54,7 +54,7 @@ final class OptionListAction extends AbstractAction
 
             // To work this action needs user information to update
             foreach (array('label', 'value', 'display', 'select_name') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new option'
diff --git a/server/src/Action/OutputCategoryAction.php b/server/src/Action/OutputCategoryAction.php
index 5e21f1dd..c7b1fe9b 100644
--- a/server/src/Action/OutputCategoryAction.php
+++ b/server/src/Action/OutputCategoryAction.php
@@ -65,7 +65,7 @@ final class OutputCategoryAction extends AbstractAction
 
             // If mandatories empty fields 400
             foreach (array('label', 'display', 'id_output_family') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the output category'
diff --git a/server/src/Action/OutputCategoryListAction.php b/server/src/Action/OutputCategoryListAction.php
index 54f131f9..66d5af57 100644
--- a/server/src/Action/OutputCategoryListAction.php
+++ b/server/src/Action/OutputCategoryListAction.php
@@ -67,7 +67,7 @@ final class OutputCategoryListAction extends AbstractAction
 
             // Verif mandatories fields
             foreach (array('label', 'display') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new output category'
diff --git a/server/src/Action/OutputFamilyAction.php b/server/src/Action/OutputFamilyAction.php
index c98b9251..a5df1ee6 100644
--- a/server/src/Action/OutputFamilyAction.php
+++ b/server/src/Action/OutputFamilyAction.php
@@ -64,7 +64,7 @@ final class OutputFamilyAction extends AbstractAction
 
             $fields = array('label', 'display', 'opened');
             foreach ($fields as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the output family'
diff --git a/server/src/Action/OutputFamilyListAction.php b/server/src/Action/OutputFamilyListAction.php
index 262fec60..a55a366a 100644
--- a/server/src/Action/OutputFamilyListAction.php
+++ b/server/src/Action/OutputFamilyListAction.php
@@ -67,7 +67,7 @@ final class OutputFamilyListAction extends AbstractAction
 
             // To work this action needs information
             foreach (array('label', 'display', 'opened') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new output family'
@@ -85,8 +85,8 @@ final class OutputFamilyListAction extends AbstractAction
     }
 
     /**
-     * @param array    $parsedBody  Contains the values ​​of the new output family sent by the user
-     * @param Dataset  $dataset     Dataset for adding the family
+     * @param array   $parsedBody Contains the values ​​of the new output family sent by the user
+     * @param Dataset $dataset    Dataset for adding the family
      *
      * @return OutputFamily
      */
diff --git a/server/src/Action/RootAction.php b/server/src/Action/RootAction.php
index e36ed0c1..0b9748fa 100644
--- a/server/src/Action/RootAction.php
+++ b/server/src/Action/RootAction.php
@@ -16,8 +16,6 @@ use Psr\Http\Message\ServerRequestInterface;
 use Psr\Http\Message\ResponseInterface;
 
 /**
- * Root action
- *
  * @author François Agneray <francois.agneray@lam.fr>
  * @package App\Action
  */
diff --git a/server/src/Action/SearchAction.php b/server/src/Action/SearchAction.php
index 7ee5e492..aade8d35 100644
--- a/server/src/Action/SearchAction.php
+++ b/server/src/Action/SearchAction.php
@@ -23,8 +23,6 @@ use App\Search\Response\IResponseFactory;
 use App\Search\SearchException;
 
 /**
- * Search action
- *
  * @author François Agneray <francois.agneray@lam.fr>
  * @package App\Action
  */
diff --git a/server/src/Action/SelectAction.php b/server/src/Action/SelectAction.php
index 751d0010..96f0f7b5 100644
--- a/server/src/Action/SelectAction.php
+++ b/server/src/Action/SelectAction.php
@@ -64,7 +64,7 @@ final class SelectAction extends AbstractAction
 
             // If mandatories empty fields 400
             foreach (array('label') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to edit the select'
@@ -88,11 +88,11 @@ final class SelectAction extends AbstractAction
     }
 
     /**
-    * Update select object with setters
-    *
-    * @param Select $select     The select object to update
-    * @param array  $parsedBody Contains the new values ​​of the select sent by the user
-    */
+     * Update select object with setters
+     *
+     * @param Select $select     The select object to update
+     * @param array  $parsedBody Contains the new values ​​of the select sent by the user
+     */
     private function editSelect(Select $select, array $parsedBody): void
     {
         $select->setLabel($parsedBody['label']);
diff --git a/server/src/Action/SelectListAction.php b/server/src/Action/SelectListAction.php
index 14202b30..40ff23ec 100644
--- a/server/src/Action/SelectListAction.php
+++ b/server/src/Action/SelectListAction.php
@@ -52,7 +52,7 @@ final class SelectListAction extends AbstractAction
 
             // To work this action needs user information to update
             foreach (array('name', 'label') as $a) {
-                if ($this->isEmptyField($a, $parsedBody)) {
+                if (!array_key_exists($a, $parsedBody)) {
                     throw new HttpBadRequestException(
                         $request,
                         'Param ' . $a . ' needed to add a new select'
diff --git a/server/src/Action/TableListAction.php b/server/src/Action/TableListAction.php
index 9fc8feed..1d017198 100644
--- a/server/src/Action/TableListAction.php
+++ b/server/src/Action/TableListAction.php
@@ -73,7 +73,7 @@ final class TableListAction extends AbstractAction
 
         if ($request->getMethod() === GET) {
             $connection = $this->connectionFactory->create($database);
-            $sm = $connection->getSchemaManager();
+            $sm = $connection->createSchemaManager();
             $tables = array(...$this->getTables($sm), ...$this->getViews($sm));
             $payload = json_encode($tables);
         }
diff --git a/server/src/Search/Query/Operator/JsonPostgres.php b/server/src/Search/Query/Operator/JsonPostgres.php
index 2284fce8..7b12db63 100644
--- a/server/src/Search/Query/Operator/JsonPostgres.php
+++ b/server/src/Search/Query/Operator/JsonPostgres.php
@@ -22,10 +22,37 @@ use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
  */
 class JsonPostgres extends Operator
 {
+    /**
+     * Path inside the json to the criterion
+     *
+     * @var string|array
+     */
     private $path;
+
+    /**
+     * Operator fot this json postgres criterion
+     *
+     * @var string
+     */
     private $operator;
+
+    /**
+     * Value of this criterion
+     *
+     * @var string
+     */
     private $value;
 
+    /**
+     * Create the class before call getExpression method to execute this operator
+     *
+     * @param ExpressionBuilder $expr
+     * @param string            $column
+     * @param string            $columnType
+     * @param string            $path
+     * @param string            $operator
+     * @param string            $value
+     */
     public function __construct(
         ExpressionBuilder $expr,
         string $column,
@@ -40,6 +67,11 @@ class JsonPostgres extends Operator
         $this->value = $value;
     }
 
+    /**
+     * This method returns the json postgres expression for this criterion
+     *
+     * @return string
+     */
     public function getExpression(): string
     {
         switch ($this->operator) {
diff --git a/server/src/Search/Query/Operator/OperatorNotNull.php b/server/src/Search/Query/Operator/OperatorNotNull.php
index 74794c93..adf2a746 100644
--- a/server/src/Search/Query/Operator/OperatorNotNull.php
+++ b/server/src/Search/Query/Operator/OperatorNotNull.php
@@ -12,8 +12,6 @@ declare(strict_types=1);
 
 namespace App\Search\Query\Operator;
 
-use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
-
 /**
  * Operator that represents a not null of a where clause
  *
diff --git a/server/src/Search/Response/TextResponse.php b/server/src/Search/Response/TextResponse.php
index 84fb062f..b51ecc5f 100644
--- a/server/src/Search/Response/TextResponse.php
+++ b/server/src/Search/Response/TextResponse.php
@@ -52,7 +52,7 @@ class TextResponse implements IResponse
      */
     public function getResponse(ResponseInterface $response, AnisQueryBuilder $anisQueryBuilder): ResponseInterface
     {
-        $stmt = $anisQueryBuilder->getDoctrineQueryBuilder()->execute();
+        $stmt = $anisQueryBuilder->getDoctrineQueryBuilder()->executeQuery();
         $attributes = $anisQueryBuilder->getAttributesSelected();
         $payload = $this->transformArrayToCsv($stmt, $attributes);
         $response->getBody()->write($payload);
@@ -73,7 +73,7 @@ class TextResponse implements IResponse
             return $attribute->getLabel();
         }, $attributes);
         $csv = implode($this->delimiter, $attributesLabel) . PHP_EOL;
-        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+        while ($row = $stmt->fetchAssociative()) {
             $csv .= implode($this->delimiter, $row) . PHP_EOL;
         }
         return $csv;
diff --git a/server/src/Search/Response/VotableResponse.php b/server/src/Search/Response/VotableResponse.php
index 68d68d9b..0ea6802a 100644
--- a/server/src/Search/Response/VotableResponse.php
+++ b/server/src/Search/Response/VotableResponse.php
@@ -34,11 +34,11 @@ class VotableResponse implements IResponse
     public function getResponse(ResponseInterface $response, AnisQueryBuilder $anisQueryBuilder): ResponseInterface
     {
         $nbRecords = $this->getNbRecords($anisQueryBuilder);
-        $stmt = $anisQueryBuilder->getDoctrineQueryBuilder()->execute();
+        $stmt = $anisQueryBuilder->getDoctrineQueryBuilder()->executeQuery();
         $dataset = $anisQueryBuilder->getDatasetSelected();
         $attributes = $anisQueryBuilder->getAttributesSelected();
         $payload = $this->getVoHeader($dataset, $attributes, $nbRecords);
-        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+        while ($row = $stmt->fetchAssociative()) {
             $payload .= $this->getVoRow($row, $attributes);
         }
         $payload .= $this->getVoFooter();
diff --git a/server/tests/Action/AttributeActionTest.php b/server/tests/Action/AttributeActionTest.php
index 9e1bb8ef..a3323c22 100644
--- a/server/tests/Action/AttributeActionTest.php
+++ b/server/tests/Action/AttributeActionTest.php
@@ -135,27 +135,25 @@ final class AttributeActionTest extends TestCase
             'form_label' => 'ID',
             'description' => 'ID description',
             'primary_key' => false,
-            'order_primary_key' => null,
-            'output_display' => 20,
-            'criteria_display' => 10,
-            'search_flag' => 'ID',
-            'search_type' => null,
             'type' => 'integer',
+            'search_type' => null,
             'operator' => null,
             'min' => null,
             'max' => null,
+            'options' => null,
             'placeholder_min' => null,
             'placeholder_max' => null,
+            'criteria_display' => 10,
+            'output_display' => 20,
+            'selected' => false,
             'renderer' => null,
             'renderer_config' => null,
-            'display_detail' => 10,
-            'selected' => false,
             'order_by' => false,
             'archive' => false,
             'detail' => false,
+            'display_detail' => 10,
             'renderer_detail' => null,
             'renderer_detail_config' => null,
-            'options' => null,
             'vo_utype' => null,
             'vo_ucd' => null,
             'vo_unit' => null,
diff --git a/server/tests/Action/AttributeDistinctActionTest.php b/server/tests/Action/AttributeDistinctActionTest.php
index 3f8f6d72..0cb3ebe7 100644
--- a/server/tests/Action/AttributeDistinctActionTest.php
+++ b/server/tests/Action/AttributeDistinctActionTest.php
@@ -76,9 +76,9 @@ final class AttributeDistinctActionTest extends TestCase
         $this->entityManager->method('getRepository')->willReturn($repository);
 
         $stmt = $this->getResultMock();
-        $stmt->method('fetchAll')->willReturn(array('value1', 'value2'));
+        $stmt->method('fetchFirstColumn')->willReturn(array('value1', 'value2'));
         $queryBuilder = $this->getQueryBuilderMock();
-        $queryBuilder->method('execute')->willReturn($stmt);
+        $queryBuilder->method('executeQuery')->willReturn($stmt);
         $connection = $this->getConnectionMock();
         $connection->method('createQueryBuilder')->willReturn($queryBuilder);
         $this->connectionFactory->method('create')->willReturn($connection);
diff --git a/server/tests/Action/AttributeListActionTest.php b/server/tests/Action/AttributeListActionTest.php
index 7b010848..e24ccd74 100644
--- a/server/tests/Action/AttributeListActionTest.php
+++ b/server/tests/Action/AttributeListActionTest.php
@@ -83,17 +83,37 @@ final class AttributeListActionTest extends TestCase
         $fields = array(
             'id' => 1,
             'name' => 'id',
-            'label' => 'id',
+            'label' => 'ID',
             'form_label' => 'ID',
+            'description' => 'ID description',
             'primary_key' => false,
             'type' => 'integer',
+            'search_type' => null,
+            'operator' => null,
+            'min' => null,
+            'max' => null,
+            'options' => null,
+            'placeholder_min' => null,
+            'placeholder_max' => null,
             'criteria_display' => 10,
-            'output_display' => 10,
-            'display_detail' => 10,
-            'archive' => false,
-            'selected' => true,
+            'output_display' => 20,
+            'selected' => false,
+            'renderer' => null,
+            'renderer_config' => null,
             'order_by' => false,
-            'detail' => false
+            'archive' => false,
+            'detail' => false,
+            'display_detail' => 10,
+            'renderer_detail' => null,
+            'renderer_detail_config' => null,
+            'vo_utype' => null,
+            'vo_ucd' => null,
+            'vo_unit' => null,
+            'vo_description' => null,
+            'vo_datatype' => null,
+            'vo_size' => 0,
+            'id_criteria_family' => null,
+            'id_output_category' => null
         );
         $this->entityManager->expects($this->once())->method('persist');
 
diff --git a/server/tests/Action/ColumnListActionTest.php b/server/tests/Action/ColumnListActionTest.php
index dac77aa6..d795fbbb 100644
--- a/server/tests/Action/ColumnListActionTest.php
+++ b/server/tests/Action/ColumnListActionTest.php
@@ -80,7 +80,7 @@ final class ColumnListActionTest extends TestCase
         $sm = $this->getAbstractSchemaManagerMock();
         $sm->method('listTableColumns')->willReturn(array($columnId, $columnRa, $columnDec));
         $connection = $this->getConnectionMock();
-        $connection->method('getSchemaManager')->willReturn($sm);
+        $connection->method('createSchemaManager')->willReturn($sm);
         $this->connectionFactory->method('create')->willReturn($connection);
 
         $request = $this->getRequest('GET');
diff --git a/server/tests/Action/TableListActionTest.php b/server/tests/Action/TableListActionTest.php
index 563b6414..c6f79fac 100644
--- a/server/tests/Action/TableListActionTest.php
+++ b/server/tests/Action/TableListActionTest.php
@@ -74,7 +74,7 @@ final class TableListActionTest extends TestCase
         $sm->method('listViews')->willReturn(array($view, $view2));
 
         $connection = $this->getConnectionMock();
-        $connection->method('getSchemaManager')->willReturn($sm);
+        $connection->method('createSchemaManager')->willReturn($sm);
 
         $this->connectionFactory->method('create')->willReturn($connection);
 
diff --git a/server/tests/Search/Response/TextResponseTest.php b/server/tests/Search/Response/TextResponseTest.php
index 2f5994af..bd27df94 100644
--- a/server/tests/Search/Response/TextResponseTest.php
+++ b/server/tests/Search/Response/TextResponseTest.php
@@ -25,7 +25,7 @@ final class TextResponseTest extends TestCase
     public function testGetResponse(): void
     {
         $stmt = $this->getResultMock();
-        $stmt->method('fetch')->willReturnOnConsecutiveCalls(array(
+        $stmt->method('fetchAssociative')->willReturnOnConsecutiveCalls(array(
             'id' => 1,
             'ra' => 102.5,
             'dec' => 0.1
@@ -39,7 +39,7 @@ final class TextResponseTest extends TestCase
         $dec->method('getLabel')->willReturn('dec');
 
         $doctrineQueryBuilder = $this->getDoctrineQueryBuilderMock();
-        $doctrineQueryBuilder->method('execute')->willReturn($stmt);
+        $doctrineQueryBuilder->method('executeQuery')->willReturn($stmt);
         $anisQueryBuilder = $this->getAnisQueryBuilderMock();
         $anisQueryBuilder->method('getDoctrineQueryBuilder')->willReturn($doctrineQueryBuilder);
         $anisQueryBuilder->method('getAttributesSelected')->willReturn(array($id, $ra, $dec));
-- 
GitLab