mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix filtering of new tasks
This commit is contained in:
parent
e63d645f8a
commit
4da32dc5ca
@ -23,6 +23,7 @@ use Chill\MainBundle\Controller\AddressApiController;
|
||||
use Chill\MainBundle\Controller\LocationController;
|
||||
use Chill\MainBundle\Controller\LocationTypeController;
|
||||
use Chill\MainBundle\Controller\UserController;
|
||||
use Chill\MainBundle\Doctrine\DQL\JsonbArrayLength;
|
||||
use Chill\MainBundle\Doctrine\DQL\STContains;
|
||||
use Chill\MainBundle\Doctrine\DQL\StrictWordSimilarityOPS;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
@ -203,6 +204,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
'OVERLAPSI' => OverlapsI::class,
|
||||
'STRICT_WORD_SIMILARITY_OPS' => StrictWordSimilarityOPS::class,
|
||||
'ST_CONTAINS' => STContains::class,
|
||||
'JSONB_ARRAY_LENGTH' => JsonbArrayLength::class,
|
||||
],
|
||||
],
|
||||
'hydrators' => [
|
||||
|
35
src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbArrayLength.php
Normal file
35
src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbArrayLength.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
namespace Chill\MainBundle\Doctrine\DQL;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\Lexer;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
use Doctrine\ORM\Query\SqlWalker;
|
||||
|
||||
/**
|
||||
* Return the length of an array
|
||||
*/
|
||||
class JsonbArrayLength extends FunctionNode
|
||||
{
|
||||
private $expr1;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf(
|
||||
'jsonb_array_length(%s)',
|
||||
$this->expr1->dispatch($sqlWalker),
|
||||
);
|
||||
}
|
||||
|
||||
public function parse(Parser $parser): void
|
||||
{
|
||||
$parser->match(Lexer::T_IDENTIFIER);
|
||||
$parser->match(Lexer::T_OPEN_PARENTHESIS);
|
||||
$this->expr1 = $parser->StringPrimary();
|
||||
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
}
|
||||
}
|
@ -110,6 +110,12 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
|
||||
$qb
|
||||
->setParameter('now', $now);
|
||||
break;
|
||||
case 'state_new':
|
||||
$orXState
|
||||
->add(
|
||||
"JSONB_ARRAY_LENGTH(t.currentStates) = 0"
|
||||
);
|
||||
break;
|
||||
case \substr($flag, 0, 6) === 'state_':
|
||||
$state = \substr($flag, 6);
|
||||
$orXState
|
||||
|
Loading…
x
Reference in New Issue
Block a user