-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02fcdcc
commit de5bed4
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql; | ||
|
||
/** | ||
* "JSON_ARRAYAGG" "(" NewValue ")" | ||
*/ | ||
class JsonArrayAgg extends MysqlJsonFunctionNode | ||
{ | ||
const FUNCTION_NAME = 'JSON_ARRAYAGG'; | ||
|
||
/** @var string[] */ | ||
protected $optionalArgumentTypes = [self::VALUE_ARG]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql; | ||
|
||
/** | ||
* "JSON_OBJECTAGG" "(" StringPrimary "," NewValue ")" | ||
*/ | ||
class JsonObjectAgg extends MysqlJsonFunctionNode | ||
{ | ||
const FUNCTION_NAME = 'JSON_OBJECTAGG'; | ||
|
||
/** @var string[] */ | ||
protected $optionalArgumentTypes = [self::STRING_PRIMARY_ARG, self::VALUE_ARG]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Scienta\DoctrineJsonFunctions\Tests\Query\Functions\Mysql; | ||
|
||
use Scienta\DoctrineJsonFunctions\Tests\Query\MysqlTestCase; | ||
|
||
class JsonGroupArrayTest extends MysqlTestCase | ||
{ | ||
public function testJsonArrayAgg() | ||
{ | ||
$this->assertDqlProducesSql( | ||
"SELECT JSON_ARRAYAGG('a') FROM Scienta\DoctrineJsonFunctions\Tests\Entities\Blank b", | ||
"SELECT JSON_ARRAYAGG('a') AS sclr_0 FROM Blank b0_" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Scienta\DoctrineJsonFunctions\Tests\Query\Functions\Mysql; | ||
|
||
use Scienta\DoctrineJsonFunctions\Tests\Query\MysqlTestCase; | ||
|
||
class JsonObjectAggTest extends MysqlTestCase | ||
{ | ||
public function testJsonObjectAgg() | ||
{ | ||
$this->assertDqlProducesSql( | ||
"SELECT JSON_OBJECTAGG('a', 1) FROM Scienta\DoctrineJsonFunctions\Tests\Entities\Blank b", | ||
"SELECT JSON_OBJECTAGG('a', 1) AS sclr_0 FROM Blank b0_" | ||
); | ||
} | ||
|
||
public function testJsonObjectAggMissingParameter() | ||
{ | ||
$this->expectException(\Doctrine\ORM\Query\QueryException::class); | ||
|
||
$this->assertDqlProducesSql( | ||
"SELECT JSON_OBJECTAGG('a') FROM Scienta\DoctrineJsonFunctions\Tests\Entities\Blank b", | ||
"SELECT JSON_OBJECTAGG('a') AS sclr_0 FROM Blank b0_" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters