Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
anis
anis-server
Commits
842e56cc
Commit
842e56cc
authored
May 28, 2019
by
François Agneray
Browse files
#26
=> ok
parent
c70d2e28
Changes
21
Hide whitespace changes
Inline
Side-by-side
src/Action/Search/SearchAction.php
View file @
842e56cc
...
...
@@ -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'
]);
...
...
src/
Search
/Operator/Between.php
→
src/
Utils
/Operator/Between.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/Equal.php
→
src/
Utils
/Operator/Equal.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/GreaterThan.php
→
src/
Utils
/Operator/GreaterThan.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/GreaterThanEqual.php
→
src/
Utils
/Operator/GreaterThanEqual.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/IOperator.php
→
src/
Utils
/Operator/IOperator.php
View file @
842e56cc
...
...
@@ -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
{
...
...
src/
Search
/Operator/IOperatorFactory.php
→
src/
Utils
/Operator/IOperatorFactory.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/In.php
→
src/
Utils
/Operator/In.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/LessThan.php
→
src/
Utils
/Operator/LessThan.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/LessThanEqual.php
→
src/
Utils
/Operator/LessThanEqual.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/Like.php
→
src/
Utils
/Operator/Like.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/NotEqual.php
→
src/
Utils
/Operator/NotEqual.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/NotIn.php
→
src/
Utils
/Operator/NotIn.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/NotLike.php
→
src/
Utils
/Operator/NotLike.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/Operator.php
→
src/
Utils
/Operator/Operator.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/OperatorException.php
→
src/
Utils
/Operator/OperatorException.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/OperatorFactory.php
→
src/
Utils
/Operator/OperatorFactory.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/OperatorNotNull.php
→
src/
Utils
/Operator/OperatorNotNull.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/Operator/OperatorNull.php
→
src/
Utils
/Operator/OperatorNull.php
View file @
842e56cc
...
...
@@ -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
;
...
...
src/
Search
/SearchException.php
→
src/
Utils
/SearchException.php
View file @
842e56cc
...
...
@@ -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
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment