Revert "Fixed JsonExpressionBuilder to generate SQL NULL"

This reverts commit cf4bd39fc1927c3cbe85c08c6fc473d60921d96f.
This commit is contained in:
SilverFire - Dmitry Naumenko
2018-03-10 11:11:11 +02:00
parent cf4bd39fc1
commit c6ea3fb455
3 changed files with 1 additions and 5 deletions

View File

@ -4,7 +4,6 @@ Yii Framework 2 Change Log
2.0.14.2 under development 2.0.14.2 under development
------------------------ ------------------------
- Bug #15863: Fixed `yii\db\pgsql\JsonExpressionBuilder` to generate SQL `NULL` instead of JSON `null` when the `JsonExpression` value is `NULL` (silverfire)
- Bug #15783: Regenerate CSRF token only when logging in directly (samdark) - Bug #15783: Regenerate CSRF token only when logging in directly (samdark)
- Bug #15801: Fixed `has-error` CSS class assignment in `yii\widgets\ActiveField` when attribute name is prefixed with tabular index (FabrizioCaldarelli) - Bug #15801: Fixed `has-error` CSS class assignment in `yii\widgets\ActiveField` when attribute name is prefixed with tabular index (FabrizioCaldarelli)
- Bug #15792: Added missing `yii\db\QueryBuilder::conditionClasses` setter (silverfire) - Bug #15792: Added missing `yii\db\QueryBuilder::conditionClasses` setter (silverfire)

View File

@ -33,9 +33,6 @@ class JsonExpressionBuilder implements ExpressionBuilderInterface
public function build(ExpressionInterface $expression, array &$params = []) public function build(ExpressionInterface $expression, array &$params = [])
{ {
$value = $expression->getValue(); $value = $expression->getValue();
if ($value === null) {
return 'NULL';
}
if ($value instanceof Query) { if ($value instanceof Query) {
list ($sql, $params) = $this->queryBuilder->build($value, $params); list ($sql, $params) = $this->queryBuilder->build($value, $params);

View File

@ -113,7 +113,7 @@ class QueryBuilderTest extends \yiiunit\framework\db\QueryBuilderTest
['=', 'data', new JsonExpression(['user' => ['login' => 'silverfire', 'password' => 'c4ny0ur34d17?'], 'props' => ['mood' => 'good']])], ['=', 'data', new JsonExpression(['user' => ['login' => 'silverfire', 'password' => 'c4ny0ur34d17?'], 'props' => ['mood' => 'good']])],
'"data" = :qp0', [':qp0' => '{"user":{"login":"silverfire","password":"c4ny0ur34d17?"},"props":{"mood":"good"}}'] '"data" = :qp0', [':qp0' => '{"user":{"login":"silverfire","password":"c4ny0ur34d17?"},"props":{"mood":"good"}}']
], ],
'null value' => [['=', 'jsoncol', new JsonExpression(null)], '"jsoncol" = NULL', []], 'null value' => [['=', 'jsoncol', new JsonExpression(null)], '"jsoncol" = :qp0', [':qp0' => 'null']],
'null as array value' => [['=', 'jsoncol', new JsonExpression([null])], '"jsoncol" = :qp0', [':qp0' => '[null]']], 'null as array value' => [['=', 'jsoncol', new JsonExpression([null])], '"jsoncol" = :qp0', [':qp0' => '[null]']],
'null as object value' => [['=', 'jsoncol', new JsonExpression(['nil' => null])], '"jsoncol" = :qp0', [':qp0' => '{"nil":null}']], 'null as object value' => [['=', 'jsoncol', new JsonExpression(['nil' => null])], '"jsoncol" = :qp0', [':qp0' => '{"nil":null}']],