Comments (6)
The spaces in the "AS" clauses is confirmed
While trying the case "Not all column names must have an alias", the column given without alias are generated like origin AS , file_type AS, year as publication_year instead of origin, file_type, year as publication_year
I can't reproduce this behavior, do you have another snippet that shows it? Currently the ternary is checking if the key is a string where "origin" and "file_type" would give me integer keys.
$selectWithAliases = array(
"origin",
"file_type",
"year" => "publication_year"
);
This is what I'm testing on PHP 7.1.6, is this an inconsistency in PHP versions?
$soql = new SoqlQuery();
$soql->select(array(
'origin',
'file_type',
'year' => 'publication_year'
));
// $select=origin,file_type,year AS publication_year
$result = (string)$soql;
from phpsoda.
Hi,
Thank you for your immediate response.
With respect to point 2:
We are actually using a YAML SQL file and we parse the YAML file using symfony https://symfony.com/doc/current/components/yaml/yaml_format.html
We were not able to generate an array with mix of (key=>value and value) with the parser. We could only generate an array with (key=>value and key=> null) .
It would be great if you can add this additional check to handle the same. Also, let us know if you have any alternative approach to this problem.
from phpsoda.
What's the generated structure look like from Symfony? I'm cool with adding the additional check 👍 Probably just need to convert it into an if statement since the nested ternaries are getting hard to understand
from phpsoda.
It generates the following array formats:
- array( "value", "value", "value");
- array("key" => "value" , "key" => "value");
- array("key" => null, "key" => "value");
We tried the combination of array("key" => "value" , "value") but Symfony is not able to recognize this format.
from phpsoda.
Ah, that makes sense. In your PR, could you do the following and I'll merge it in:
-
Add unit tests to test against both array structures:
array( "origin", "file_type", "year" => "publication_year" );
and
array( "origin" => null, "file_type" => null, "year" => "publication_year" );
-
Split up the nested ternaries into an if statement. Something like this?
if (is_string($key) && !is_null($value)) { $formattedValues[] = rawurlencode(sprintf($format, trim($key), trim($value))); } else { $formattedValues[] = is_string($key) ? $key : $value; }
from phpsoda.
I have completed the above. Hope the test cases are fine.
Thanks
from phpsoda.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpsoda.