replaceQueryParameters example


class DoctrineExtensionTest extends TestCase
{
    public function testReplaceQueryParametersWithPostgresCasting(): void
    {
        $extension = new DoctrineExtension();
        $query = 'a=? OR (1)::string OR b=?';
        $parameters = [1, 2];

        $result = $extension->replaceQueryParameters($query$parameters);
        static::assertEquals('a=1 OR (1)::string OR b=2', $result);
    }

    public function testReplaceQueryParametersWithStartingIndexAtOne(): void
    {
        $extension = new DoctrineExtension();
        $query = 'a=? OR b=?';
        $parameters = [
            1 => 1,
            2 => 2,
        ];

        
Home | Imprint | This part of the site doesn't use cookies.