# |
Mar 11th 2019, 16:20 |
jeremyharris |
it happens to all of us! |
# |
Mar 11th 2019, 16:20 |
tjkalinowski |
:( and 45 minuts of searching for error is gone ..... :( |
# |
Mar 11th 2019, 16:19 |
jeremyharris |
@tjkalinowski I think its a typo, you want to use `conditions` (plural) |
# |
Mar 11th 2019, 16:18 |
jeremyharris |
no I don’t think you can add options at that point |
# |
Mar 11th 2019, 16:18 |
slackebot |
<tjkalinowski> |
# |
Mar 11th 2019, 16:18 |
martin |
but you can’t give options to that finder I quess? |
# |
Mar 11th 2019, 16:18 |
martin |
``` $this->hasOne('ClosestStorePrices', [ 'foreignKey' => 'product_id', 'finder' => 'closestPrice', 'className' => 'StorePrices' ]);``` |
# |
Mar 11th 2019, 16:17 |
jeremyharris |
the $q should be the finder query already, and you can stack on it as you please |
# |
Mar 11th 2019, 16:17 |
jeremyharris |
so the finder is defined on the association definition? if so, you can use what I wrote above and skip the finder as it is already applied |
# |
Mar 11th 2019, 16:16 |
martin |
then you will add an extra finder to the association. But I already added that in the model, |
# |
Mar 11th 2019, 16:15 |
jeremyharris |
do you mean something like this? `$query->contain('Association', function ($q) { return $q->find('closestPrice')->where(['something' => 'else']); })` |
# |
Mar 11th 2019, 16:12 |
martin |
but when I want to do a finder that I use like $q->find(‘closestPrice’, [‘forStore’ => 45]); I can’t do that with a contain? where the finder of de association is that finder? |
# |
Mar 11th 2019, 16:07 |
neon1024 |
My guess if you have one slow endpoint |
# |
Mar 11th 2019, 16:07 |
david |
all my tests goes fine, via postman it never never never has failed |
# |
Mar 11th 2019, 16:07 |
neon1024 |
Build a picture using diagnostic tooling |
# |
Mar 11th 2019, 16:07 |
neon1024 |
Add in some logging, check your performance, try siege, test with postman |
# |
Mar 11th 2019, 16:06 |
neon1024 |
What I would suggest would be to get started |
# |
Mar 11th 2019, 16:06 |
neon1024 |
This all sounds like you’ve no idea what’s going on and haven’t started your investigation yet |
# |
Mar 11th 2019, 16:05 |
david |
but I don't know if there is anything I could look for |
# |
Mar 11th 2019, 16:05 |
david |
it seems a server problem, not implementation |
# |
Mar 11th 2019, 16:05 |
david |
not only sometimes randomly... then, app begans to work fine, until the next time it goes slow |
# |
Mar 11th 2019, 16:04 |
david |
no crash, I mean... it should fails always |
# |
Mar 11th 2019, 16:04 |
neon1024 |
Well it wouldn’t crash, but your web service would probably return a code for missing OPTIONS verb |
# |
Mar 11th 2019, 16:03 |
david |
but it was a CORS problem, it should crash always, isn't it? |
# |
Mar 11th 2019, 16:03 |
david |
no, as far as I know |
# |
Mar 11th 2019, 16:01 |
neon1024 |
Then again, the app won’t be a browser I’d guess |
# |
Mar 11th 2019, 16:01 |
neon1024 |
Could be CORS |
# |
Mar 11th 2019, 16:01 |
neon1024 |
Are they doing pre-flight checks? |
# |
Mar 11th 2019, 15:52 |
david |
we have developed an API REST, which works really fast when requesting from postman. An IOS developer consumes the api from a native app, and it works really slow... sometimes. When it works, it works fine, but many times it exceeds the time. Is there any setup which I could check? It seems to be a problem from the app, not the api, but I don't know how to check this. Logs dir is empty. |
# |
Mar 11th 2019, 15:51 |
jeremyharris |
yea, use the second parameter of contain() to add to the query |
# |
Mar 11th 2019, 15:38 |
martin |
hmm if I have a hasone, relation, and I contain that one in query, can I give options for that finder method? |
# |
Mar 11th 2019, 15:22 |
tjkalinowski |
@martin nothing more comes to my mind. |
# |
Mar 11th 2019, 15:22 |
tjkalinowski |
@martin You have to add one filed to table, and then order by this filed. |
# |
Mar 11th 2019, 15:05 |
martin |
just-> |
# |
Mar 11th 2019, 15:02 |
martin |
ok, how do you do that? |
# |
Mar 11th 2019, 15:02 |
neon1024 |
I have a few places where I do that |
# |
Mar 11th 2019, 15:01 |
neon1024 |
It does |
# |
Mar 11th 2019, 14:59 |
martin |
ah it is possible in mysql: `select * from stores where id in(2,8,4) order by FIELD(`id`, 2, 8, 4);` so I think that should work in cake too, lets try :) |
# |
Mar 11th 2019, 14:53 |
martin |
Like I have to get 1 price of product_id with store_id one of 4,6,1 and the first one in that order |
# |
Mar 11th 2019, 14:52 |
martin |
hmm maybe I can fix this with a custom finder? but how can I order by a choosen order? :P |
# |
Mar 11th 2019, 14:37 |
martin |
like Walmart (not really walmart but I have to choose a name for now) international have a price for the country, but not all stores have the same price, they can change it |