# |
May 17th 2019, 16:04 |
dereuromark |
omg.. @admad I am surprised how easy it was to apply something similar to read() here. But one key difference: It is cleaner if the path is an array here right away: https://github.com/dereuromark/cakephp-dto/pull/22 |
# |
May 17th 2019, 16:02 |
neothermic |
ok, so I've concluded that for anything other than simple singular value extracts, Set::extract and Hash::extract are not 100% compatible with each other |
# |
May 17th 2019, 15:23 |
jeremyharris |
I suppose the query explainer would give me the hard truth |
# |
May 17th 2019, 15:23 |
admad |
i wonder what use case requires exact name matches like the query showed above yields |
# |
May 17th 2019, 15:21 |
jeremyharris |
fair enough :P |
# |
May 17th 2019, 15:21 |
admad |
only if the concatenation is more efficient than one LIKE |
# |
May 17th 2019, 15:20 |
jeremyharris |
side question: from a performance standpoint, would one LIKE be more efficient than 2? I wouldn’t think so since it has to do a full table scan anyway |
# |
May 17th 2019, 15:20 |
martin |
```$user = $this->Users->find()->where(function ($exp, $query) use ($line) { $conc = $query->func()->concat([ 'firstname' => 'identifier', ' ', 'lastname' => 'identifier' ]); return $exp->eq($conc, $line); })->first();``` |
# |
May 17th 2019, 15:19 |
jeremyharris |
I guess if you’re he’s looking for an exact match, I just assumed fuzzy |
# |
May 17th 2019, 15:18 |
admad |
why bother concating? `WHERE first_name like ‘%jeremy%’ OR last_name like ‘%jeremy%’` would yield the same matches |
# |
May 17th 2019, 15:16 |
jeremyharris |
so something like WHERE CONCAT(first_name. ' ‘, last_name) like ‘%jeremy%’ |
# |
May 17th 2019, 15:16 |
martin |
found it |
# |
May 17th 2019, 15:16 |
martin |
oh, yes just started thinking about googleing on concat instead combine :P |
# |
May 17th 2019, 15:15 |
jeremyharris |
concat |
# |
May 17th 2019, 15:15 |
martin |
I’ve users with a firstname and lastname field in database. now I need to search on full name? what is best way to do this? need to combine 2 fields (with space between). I know how to do this in mysql but how do I do it the right way in cake query? |
# |
May 17th 2019, 15:09 |
admad |
i don't but that does look useful |
# |
May 17th 2019, 15:04 |
dereuromark |
Is someone using DTOs yet as well? Does read() make sense similar to cake core? https://github.com/dereuromark/cakephp-dto/issues/21 |
# |
May 17th 2019, 14:33 |
voycey |
had the benefit of slimming down our code somewhat |
# |
May 17th 2019, 14:33 |
voycey |
we re-wrote to be honest - it was a killer trying to migrate |
# |
May 17th 2019, 14:06 |
neothermic |
we did cake 1 to cake 2 a few years back, and now the cake2 is even larger than before... |
# |
May 17th 2019, 14:06 |
nils |
Haha, I don't envy you! |
# |
May 17th 2019, 14:06 |
neothermic |
Welcome to my hell, except this codebase started late 2010 on cake1 :) |
# |
May 17th 2019, 14:05 |
nils |
I guess. I'm the only developer in it. The project started 2013 so I get quite frustrated with the 2013-version of me. :slightly_smiling_face: |
# |
May 17th 2019, 14:02 |
neothermic |
how large the codebase is, how many developers you have, how many cake2-isims you've got, how recent your cake2 install is, how much you rely on removed functionality, etc |
# |
May 17th 2019, 14:01 |
neothermic |
I suspect the time it takes varies on multiple factors |
# |
May 17th 2019, 14:01 |
neothermic |
I'm slowly doing that now |
# |
May 17th 2019, 14:01 |
nils |
Did anyone migrate from 2.x to 3.x? How time consuming should I expect it to be? |
# |
May 17th 2019, 14:00 |
neothermic |
but yeah, any thoughts on why this isn't behaving the same? |
# |
May 17th 2019, 13:57 |
neothermic |
:) |
# |
May 17th 2019, 13:57 |
dereuromark |
I know I am |
# |
May 17th 2019, 13:56 |
dereuromark |
you know, there are things in life where you want to be replaced by machines |
# |
May 17th 2019, 13:56 |
neothermic |
but this one is odd, as I'm not sure why I'm losing the subkey; is that expected? |
# |
May 17th 2019, 13:56 |
neothermic |
well, the basic testcase is me running the change manually, comparing the outputs :) |
# |
May 17th 2019, 13:56 |
dereuromark |
always good to have basic test cases around your internal business logic to catch this early on when migrating |
# |
May 17th 2019, 13:55 |
neothermic |
but Hash::Extract with the path of `'Report'` returns the data without the 'Report' subkeying |
# |
May 17th 2019, 13:54 |
neothermic |
So we have an array that is basically from a find, that contains a key called 'Report', and then has subitems, and each item is an array of id, etc. `Set::extract('/Report'` on the data returns structure like: ```array( (int) 0 => array( 'Report' => array( 'id' => '45' |
# |
May 17th 2019, 13:52 |
neothermic |
argh, Hash::extract is doing something slightly different from Set::extract :O |
# |
May 17th 2019, 13:20 |
neon1024 |
Sounds good, sign me up @admad |
# |
May 17th 2019, 13:20 |
admad |
are PHP "influencers" available for hire? we could then spend 1 year's cakefest budget on them instead :P |
# |
May 17th 2019, 13:18 |
np |
:wave: I forwarded your response to my colleague. Thanks |
# |
May 17th 2019, 13:18 |
dereuromark |
One reddit article after 4.0 release might do the trick :P and noise |