Commit fd08ad37 authored by François Agneray's avatar François Agneray
Browse files

#2 done

parent 74acc2be
......@@ -43,7 +43,7 @@ CREATE TABLE public.obs_cat (
);
 
 
ALTER TABLE public.obs_cat OWNER TO postgres;
ALTER TABLE public.obs_cat OWNER TO anis;
 
--
-- TOC entry 2862 (class 0 OID 16683)
......
......@@ -2,10 +2,10 @@
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER anis;
CREATE USER anis LOGIN PASSWORD 'anis';
CREATE DATABASE anis_metamodel;
CREATE DATABASE anis_test;
GRANT ALL PRIVILEGES ON DATABASE anis_metamodel TO anis;
GRANT ALL PRIVILEGES ON DATABASE anis_test TO anis;
EOSQL
psql -v ON_ERROR_STOP=1 -f /sql/anis_test.sql --username "$POSTGRES_USER" --dbname "anis_test"
\ No newline at end of file
psql -v ON_ERROR_STOP=1 -f /sql/anis_test.sql --username "anis" --dbname "anis_test"
\ No newline at end of file
......@@ -13,8 +13,8 @@ services:
METADATA_DB_HOST: "db"
METADATA_DB_PORT: 5432
METADATA_DB_DBNAME: "anis_metamodel"
METADATA_DB_USER: "postgres"
METADATA_DB_PASSWORD: "postgres"
METADATA_DB_USER: "anis"
METADATA_DB_PASSWORD: "anis"
MAILER_HOST: "mailer"
MAILER_PORT: 25
LOGGER_NAME: "anis-v3-server"
......
......@@ -36,11 +36,11 @@ abstract class AbstractSearchAction extends AbstractAction
$criteria = explode(';', $queryParams['c']);
$queryBuilder->where('1 = 1');
foreach ($criteria as $criterion) {
$params = explode('|', $criterion);
$params = explode(':', $criterion);
$attribute = $this->em->find('App\Entity\Attribute', $params[0]);
switch ($params[1]) {
case 'bw':
$values = explode(':', $params[2]);
$values = explode('|', $params[2]);
$column = $attribute->getTableName() . '.' . $attribute->getName();
$queryBuilder->andWhere($queryBuilder->expr()->gte($column, $values[0]));
$queryBuilder->andWhere($queryBuilder->expr()->lte($column, $values[1]));
......
......@@ -57,7 +57,7 @@ final class SearchDataAction extends AbstractSearchAction
private function addSelect(QueryBuilder $queryBuilder, Dataset $dataset, array $queryParams): void
{
if (array_key_exists('a', $queryParams)) {
$listIds = explode(':', $queryParams['a']);
$listIds = explode(';', $queryParams['a']);
$attributes = $dataset->getAttributes();
$foundedAttributes = array();
......@@ -82,7 +82,7 @@ final class SearchDataAction extends AbstractSearchAction
if (array_key_exists('o', $queryParams)) {
$orders = explode(';', $queryParams['o']);
foreach($orders as $order) {
$o = explode('-', $order);
$o = explode(':', $order);
$attribute = $this->em->find('App\Entity\Attribute', $o[0]);
if ($o[1] === 'a') {
$aord = 'ASC';
......
......@@ -166,14 +166,14 @@ class Attribute implements \JsonSerializable
*
* @Column(type="boolean", name="selected", nullable=false, options={"default":false})
*/
protected $selected;
protected $selected = false;
/**
* @var bool
*
* @Column(type="boolean", name="order_by", nullable=false, options={"default":false})
*/
protected $orderBy;
protected $orderBy = false;
/**
* @var int
......@@ -187,7 +187,7 @@ class Attribute implements \JsonSerializable
*
* @Column(type="boolean", name="detail", nullable=false, options={"default":false})
*/
protected $detail;
protected $detail = false;
/**
* @var string
......
......@@ -23,7 +23,7 @@ class DBALConnectionFactory
'password' => $database->getPassword(),
'host' => $database->getHost(),
'port' => $database->getPort(),
'driver' => $database->getType(),
'driver' => 'pdo_' . $database->getType(),
);
$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
......
......@@ -12,7 +12,7 @@
return [
'settings' => [
// slim framework settings
'displayErrorDetails' => getenv('SLIM_DISPLAY_ERROR_DETAILS'),
'displayErrorDetails' => (bool) getenv('SLIM_DISPLAY_ERROR_DETAILS'),
'determineRouteBeforeAppMiddleware' => false,
'addContentLengthHeader' => false, // Allow the web server to send the content-length header
// metadata settings (doctrine 2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment