# |
Jun 14th 2018, 20:00 |
edgaras.jan |
yes |
# |
Jun 14th 2018, 19:59 |
rightscoreanalysis |
do i need to call toArray first? |
# |
Jun 14th 2018, 19:59 |
edgaras.jan |
`$first = array_pop($rows);`, $rows now contains 2-10 |
# |
Jun 14th 2018, 19:58 |
rightscoreanalysis |
any suggestion on how to do this, I could use toArray? But can I get the result as an object? |
# |
Jun 14th 2018, 19:57 |
rightscoreanalysis |
I am querying my table for 10 results, I want to split the results into different variables. So for example the first row should be passed into one varialb,e row 2-10 into another |
# |
Jun 14th 2018, 17:24 |
itamer |
thanks @neon1024, it's in the docs, works sometimes, I've put in a test and workaround. |
# |
Jun 14th 2018, 15:34 |
mikesmoniker |
`IdentifierExpression`? |
# |
Jun 14th 2018, 15:31 |
LubosR |
I mean for performance reason i don't want to quote all, just one identifier |
# |
Jun 14th 2018, 15:26 |
LubosR |
How do I escape reserved word (key) when savingData? I have quoteIdentifiers set to false and I want to escape it somehow when creating entity |
# |
Jun 14th 2018, 14:33 |
jeremyharris |
mm yeah reversing the key/value pairs works well, thanks again @admad @lorenzo |
# |
Jun 14th 2018, 14:31 |
jeremyharris |
thanks for the help! |
# |
Jun 14th 2018, 14:31 |
jeremyharris |
yep that’s it. okay I’ll go about it a different way |
# |
Jun 14th 2018, 14:31 |
jeremyharris |
ah |
# |
Jun 14th 2018, 14:30 |
lorenzo |
the same MAX() that is |
# |
Jun 14th 2018, 14:30 |
lorenzo |
there may be 2 values with the same key |
# |
Jun 14th 2018, 14:30 |
lorenzo |
ah, that’s the issue actually |
# |
Jun 14th 2018, 14:30 |
jeremyharris |
same result @admad, missing a record |
# |
Jun 14th 2018, 14:30 |
admad |
have you tried toList() instead of toArray() |
# |
Jun 14th 2018, 14:29 |
jeremyharris |
`SELECT (MAX(organization_id)) AS `organization_id`, (substring_index(Users.email, :param0, :param1)) AS `domain` FROM users Users GROUP BY domain ORDER BY domain` |
# |
Jun 14th 2018, 14:28 |
lorenzo |
what’s the generated query for that failing test case? |
# |
Jun 14th 2018, 14:28 |
jeremyharris |
that’s what’s confusing me. I used array_values because the org id could change depending on the fixtures |
# |
Jun 14th 2018, 14:28 |
jeremyharris |
the point is that it’s missing one domain for some reason |
# |
Jun 14th 2018, 14:27 |
lorenzo |
that threw me off |
# |
Jun 14th 2018, 14:27 |
lorenzo |
ah, did not see you were calling array_values |
# |
Jun 14th 2018, 14:27 |
jeremyharris |
(trying multiple solutions at one time) |
# |
Jun 14th 2018, 14:27 |
jeremyharris |
I pasted in the wrong failure sorry, hold on let me re-run the tests |
# |
Jun 14th 2018, 14:27 |
lorenzo |
is `organization_id` the key? |
# |
Jun 14th 2018, 14:27 |
jeremyharris |
oh you mean the failure |
# |
Jun 14th 2018, 14:26 |
jeremyharris |
shouldn’t it create a key=>value from all the returned results? I don’t understand why it would skip the 0 index |
# |
Jun 14th 2018, 14:26 |
jeremyharris |
not sure I understand |
# |
Jun 14th 2018, 14:24 |
lorenzo |
@jeremyharris how can `->combine('organization_id', 'domain')` return an array starting with 0? |
# |
Jun 14th 2018, 14:15 |
savant |
not yet, still hammering out specific details |
# |
Jun 14th 2018, 14:15 |
itmpls |
oh damn. I think I didn't commit/"up" the Model/Table for that |
# |
Jun 14th 2018, 14:14 |
neon1024 |
@savant Did you publish your article about Cakefest yet? |
# |
Jun 14th 2018, 14:14 |
jeremyharris |
if anybody has some good mysql grouping experience, I could use some help. I can’t seem to get my tests to pass (and expected results) if I add another aggregate column to my query: https://gist.github.com/jeremyharris/4b48e1257e081f710cffd35a320144eb |
# |
Jun 14th 2018, 14:13 |
itmpls |
don't tell me it's a typo.. |
# |
Jun 14th 2018, 14:12 |
itmpls |
i just pushed these code changes |
# |
Jun 14th 2018, 14:12 |
itmpls |
im pretty sure i wiped the orm cache but i'll try again too |
# |
Jun 14th 2018, 14:11 |
itmpls |
File uploaded https://cakesf.slack.com/files/U9ZTHJF2B/FB7P0767P/screen_shot_2018-06-14_at_10.10.03_am.png / https://slack-files.com/T053DPNCM-FB7P0767P-485c8fd322 |
# |
Jun 14th 2018, 14:09 |
itmpls |
i'll figure it out, sec |
# |
Jun 14th 2018, 14:09 |
itmpls |
yeah lol |