# |
Dec 9th 2016, 17:56 |
spriz |
@admad: the book states the opposite :thinking_face: |
# |
Dec 9th 2016, 17:52 |
admad |
perhaps i should just keep quite today |
# |
Dec 9th 2016, 17:52 |
admad |
Neon1024: sorry, earlier even though you linked cakedc/search my mind read it as foc/search and i responded accordingly :slightly_smiling_face: |
# |
Dec 9th 2016, 17:43 |
pbaire |
Hi! I was looking at dbosource file from cake 2.x [ ref https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Model/Datasource/DboSource.php#L3261�], anybody knows why the design of insertMulti prepares a single statement and then make an execute for every inserted record instead of preparing a unique statement with all values that it can be executed later and in one-shot? |
# |
Dec 9th 2016, 17:40 |
admad |
Oh you are talking about resource routes, sorry |
# |
Dec 9th 2016, 17:38 |
admad |
@spriz it's just you since it's possible to specify the default route class to use |
# |
Dec 9th 2016, 17:25 |
pbaire |
hi |
# |
Dec 9th 2016, 17:21 |
savant |
im backkk its a dinosaur story |
# |
Dec 9th 2016, 17:05 |
pbaire |
I moved db on an aws instance, a huge insertMulti cause a timeout on db connection, I've modified the function for use a single prepared statement instead of multi , if someone thinks it's be useful I can make a PR into repository |
# |
Dec 9th 2016, 17:02 |
pbaire |
Hi! I was looking at dbosource file from cake 2.x , there's a reason why the insertMulti function make a single insert for every inserted record instead of preparing a unique statement executed later? [ ref https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Model/Datasource/DboSource.php#L3261�] |
# |
Dec 9th 2016, 17:00 |
Leonardo_0112 |
BC ? |
# |
Dec 9th 2016, 16:58 |
hmic |
otoh, it is easier to programmatically build arrays than object chains :p |
# |
Dec 9th 2016, 16:58 |
hmic |
the array syntax is BC imho |
# |
Dec 9th 2016, 16:57 |
philipgrey |
as to why, someone else would be better equipped to answer |
# |
Dec 9th 2016, 16:57 |
philipgrey |
you should use the object syntax |
# |
Dec 9th 2016, 16:48 |
Leonardo_0112 |
Why cake has the array and the object syntax for find method? Any fallback? Which should I use? |
# |
Dec 9th 2016, 16:41 |
Leonardo_0112 |
philipgrey, thanks |
# |
Dec 9th 2016, 16:41 |
Leonardo_0112 |
It worked! http://pastebin.com/GZ7LxCUg |
# |
Dec 9th 2016, 16:40 |
pbaire |
Hi to all! |
# |
Dec 9th 2016, 16:29 |
din |
Still struggling with the onlyIds option. Code here: http://pastebin.com/VycMMiah Works the first time when adding, but even just re-saving removes the shipment id from the package and creates a new, empty package for some reason |
# |
Dec 9th 2016, 16:26 |
philipgrey |
something like that? |
# |
Dec 9th 2016, 16:26 |
philipgrey |
```->matching(‘Categories', function ($q) { return $q->where([‘categories.id IN' => [1,2,3]]); });``` |
# |
Dec 9th 2016, 16:25 |
philipgrey |
i believe just object, it needs to be chained |
# |
Dec 9th 2016, 16:24 |
Leonardo_0112 |
philipgrey, Can I use matching with array syntax? Or just object (->matching(...)) ?? |
# |
Dec 9th 2016, 16:24 |
philipgrey |
which will filter down your products by the categories |
# |
Dec 9th 2016, 16:23 |
philipgrey |
i believe you watching to use the matching functionality |
# |
Dec 9th 2016, 16:22 |
Leonardo_0112 |
philipgrey, Yes, all products tht belongs to categories 1, 2 and 3 |
# |
Dec 9th 2016, 16:20 |
philipgrey |
do you want products within those categories? |
# |
Dec 9th 2016, 16:18 |
Leonardo_0112 |
Can someone help me? What am I missing in many-to-many find? http://pastebin.com/0pFMM3r3 |
# |
Dec 9th 2016, 16:16 |
philipgrey |
Them brackets… i tell ya |
# |
Dec 9th 2016, 16:16 |
philipgrey |
```$contain['CustomerRecords.Leads'] = function ($q) { return $q->matching('Users', function ($r) { return $r->where(['Users.id' => $this->AuthUser->id()]); }); };``` |
# |
Dec 9th 2016, 16:15 |
philipgrey |
If it’s of interest to anyone, I solved my query above |
# |
Dec 9th 2016, 16:07 |
Neon1024 |
I need to do a distinct, but I have lots of contains |
# |
Dec 9th 2016, 16:07 |
Neon1024 |
Does Cake 2 have autofields? |
# |
Dec 9th 2016, 15:59 |
philipgrey |
id love to hear a better way though |
# |
Dec 9th 2016, 15:59 |
philipgrey |
thats what i do @spriz |
# |
Dec 9th 2016, 15:58 |
spriz |
When having a ton of resource routes, it seems crazy to put the custom option there every time for the dashed route - or is it just me? :thinking_face: |
# |
Dec 9th 2016, 15:49 |
philipgrey |
intuitively it feels like it shouldn’t be a problem |
# |
Dec 9th 2016, 15:49 |
philipgrey |
is it possible to use matching within a contain conditional? |
# |
Dec 9th 2016, 15:49 |
philipgrey |
```$contain['CustomerRecords.Leads'] = function ($q) { return $q->matching(['Users'], function ($r) { $r->where(['Users.id' => $this->AuthUser->id()]); }); };``` |
# |
Dec 9th 2016, 15:38 |
din |
I don't know if I've misinterpreted what the onlyIds option is supposed to do, or whether I'm doing something else wrong |