...
(new Query())
->select([
'overtime' => '1.3',
])
...
or
...
(new Query())
->select([
"'1.3' AS `overtime`",
])
...
the generated query to be:
SELECT '1.3' AS `overtime` ...
the generated query is:
SELECT `1`.`3` AS `overtime` ...
| Q | A
| ---------------- | ---
| Yii version | 2.0.16-dev
| PHP version | 7.2.10
I don't think that this is a bug - if you want avoid quoting you should use Expression - this is explained in select() documentation. See https://github.com/yiisoft/yii2/pull/17017/files#r245482467
$q = (new Query())
->select([new Expression("'overtime' AS '1.3'")])
->from('sometable');
$comm = $q->createCommand();
var_dump($comm->getSql());exit;
I have got SELECT 'overtime' AS '1.3' FROM "sometable" as result
Second case isn't a bug as @rob006 noted.
@tsanchev what's the problem with
(new Query())
->select([
'overtime' => '1.3',
])
?
@samdark With both i've got the same result, but I guess i should use Expression so it's not a bug