-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Can't have space in column alias field (Query Builder) #14535
Comments
This seems to be an issue with the PHQL parser. Assigning it to @sergeyklay to work his magic. |
Thank you, this is a huge issue for me right now! Is this possible to get done before the 4.1 release? @sergeyklay |
Try with double quotes $columns = [
'"First Name"' => 'People.firstName',
'"Last Name"' => 'People.lastName',
]; |
It's a good idea, but I have tried and it doesn't work. Tried escaping
quotes inside of quotes, single and double quote combinations, etc.
…On Sun, Nov 17, 2019, 3:05 AM Anton Vasiliev ***@***.***> wrote:
Try with double quotes
$columns = [ '"First Name"' => 'People.firstName', '"Last Name"' => 'People.lastName',];
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14535?email_source=notifications&email_token=AJCJJ3ADAOBCVLHN53WMWPDQUEJPLA5CNFSM4JOB4GG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEIIJCI#issuecomment-554730633>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJCJJ3CR5NU37NWYZMDXUPDQUEJPLANCNFSM4JOB4GGQ>
.
|
Last try with |
@Jeckerson, And trying to use that to wrap/convert the string doesn't work as the string value (through __string or getValue(), still equals the string with a space) /**
* Verification showing that the new RawValue function doesn't wrap or escape the string.
* @test
*/
public function testUsingRawValue() : void{
$firstNameString = new RawValue("First name");
self::assertTrue($firstNameString->__toString() === "First name", "Not equal to the string representation");
self::assertTrue($firstNameString->getValue() === "First name", "Not equal to the string representation");
} |
Implemented in 4.1.x branch |
Describe the bug
I'm unable to have a field in a query get returned that has a space in it. For example if I wanted the field 'lastName' to display as 'Last Name'
I've tried putting quotes, escaping quotes, etc in that key, but none of it will take effect.
Phalcon\Mvc\Model\Exception : Scanning error before 'First Name], Peo...' when parsing: SELECT People.firstName AS [First Name], People.lastName AS [Last Name] FROM [BMS\Test\Database\Models\People] (110)
To Reproduce
Simple use any Phalcon Model class you have to get the query builder.
Expected behavior
A clear and concise description of what you expected to happen.
I would expect that I could in fact re-name a column to have a space in it, like I can in SQL.
SELECT
People
.firstName
ASFirst Name
,Details
php --ri phalcon
)php --ri phalcon
phalcon
Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.4.1
Build Date => Nov 12 2018 13:54:28
Powered by Zephir => Version 0.10.10-d1b4cc68d9
Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.disable_assign_setters => Off => Off
PHP Version: (
php -v
)PHP 7.2.18 (cli) (built: May 2 2019 13:03:01) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans
with Zend OPcache v7.2.18, Copyright (c) 1999-2018, by Zend Technologies
Operating System:
Mac OS
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: