mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
DX: fix deprecation in dql custom function + add test
This commit is contained in:
parent
76aa9c7058
commit
61db0d6a28
@ -27,7 +27,7 @@ class JsonbExistsInArray extends FunctionNode
|
|||||||
return sprintf(
|
return sprintf(
|
||||||
'%s ?? %s',
|
'%s ?? %s',
|
||||||
$this->expr1->dispatch($sqlWalker),
|
$this->expr1->dispatch($sqlWalker),
|
||||||
$sqlWalker->walkInputParameter($this->expr2)
|
$this->expr2->dispatch($sqlWalker)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Doctrine\DQL;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class JsonbExistsInArrayTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDQLFunctionWorks()
|
||||||
|
{
|
||||||
|
$result = $this->em
|
||||||
|
->createQuery('SELECT JSONB_EXISTS_IN_ARRAY(u.attributes, :param) FROM ' . User::class . ' u')
|
||||||
|
->setParameter('param', 'fr')
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
$this->assertIsArray($result);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user