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

#26 => ok

parent c70d2e28
......@@ -19,8 +19,8 @@ use Psr\Http\Message\ResponseInterface as Response;
use App\Utils\ActionTrait;
use App\Utils\DBALConnectionFactory;
use App\Search\SearchException;
use App\Search\Operator\IOperatorFactory;
use App\Utils\SearchException;
use App\Utils\Operator\IOperatorFactory;
use App\Entity\Dataset;
use App\Entity\Attribute;
......@@ -56,7 +56,7 @@ final class SearchAction
private $dcf;
/**
*
*
* @var IOperatorFactory
*/
private $operatorFactory;
......@@ -138,8 +138,10 @@ final class SearchAction
$this->where($queryBuilder, $dataset, explode(';', $queryParams['c']));
}
$listOfIds = explode(';', $queryParams['a']);
if ($args['type'] === 'data') {
$this->select($queryBuilder, $dataset, explode(';', $queryParams['a']));
$this->select($queryBuilder, $dataset, $listOfIds);
if (array_key_exists('o', $queryParams)) {
$this->order($queryBuilder, $dataset, explode(';', $queryParams['o']));
......@@ -155,6 +157,15 @@ final class SearchAction
$count = $this->fetchAll($queryBuilder);
$result = array();
$result['dataset_selected'] = $dataset->getLabel();
$attributesSelected = array();
foreach ($listOfIds as $id) {
$attribute = $this->getAttribute($dataset, (int) $id);
$attributesSelected[] = array(
'name' => $attribute->getName(),
'label' => $attribute->getLabel()
);
}
$result['attributes_selected'] = $attributesSelected;
$result['total_items'] = $count[0]['nb'];
} else {
throw SearchException::typeOfSearchDoesNotExist($args['type']);
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
use Doctrine\DBAL\Query\Expression\CompositeExpression;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
interface IOperator
{
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
use Doctrine\DBAL\Types\Type;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Exception;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search\Operator;
namespace App\Utils\Operator;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
......
......@@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Search;
namespace App\Utils;
use Exception;
......
Supports Markdown
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