# |
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 |
# |
Mar 11th 2019, 14:36 |
ricksaccous |
that's tricky |
# |
Mar 11th 2019, 14:35 |
ricksaccous |
i seeee |
# |
Mar 11th 2019, 14:35 |
martin |
no Only one, but if that one does not have to price, the price of the first parent with price |
# |
Mar 11th 2019, 14:35 |
ricksaccous |
what do you mean by this: Now I’ve have to find the closest price by a product for the store |
# |
Mar 11th 2019, 14:35 |
ricksaccous |
i have no idea, do you need the prices of every store? |
# |
Mar 11th 2019, 14:34 |
martin |
hmm, but how can I contain all parents? |
# |
Mar 11th 2019, 14:33 |
ricksaccous |
you'll probably want to specify fields in the query in case things get too ugly |
# |
Mar 11th 2019, 14:32 |
ricksaccous |
i suppose so... |
# |
Mar 11th 2019, 14:32 |
martin |
hmm ok so then I always have to contain all parents of store with the prices |
# |
Mar 11th 2019, 14:31 |
ricksaccous |
you'll have to handle the situation where the models aren't contained though |
# |
Mar 11th 2019, 14:30 |
ricksaccous |
sounds like you'll have to contain multiple models and you can do the price logic in the entity if you want |
# |
Mar 11th 2019, 14:28 |
slackebot |
parent. I believe there is no default relation for that so that I can simple contain the price to query? |
# |
Mar 11th 2019, 14:28 |
martin |
Hello world! I’ve a question, I’ve a products database, and a database with prices per store. Stores are a tree. the group (or subgroup) of a store can have a price of a product, and we will have a price on group, or a direct on the store. Now I’ve have to find the closest price by a product for the store, So I have to search the tree up for the price, does store not have it, check if parent has it, does parent does not have a price chec |
# |
Mar 11th 2019, 14:27 |
neon1024 |
:drooling_face: |
# |
Mar 11th 2019, 14:27 |
neon1024 |
Stroopwaffel! |
# |
Mar 11th 2019, 14:21 |
josbeir |
gmt+1 over here tho :P |
# |
Mar 11th 2019, 14:20 |
ricksaccous |
top it up with mad syrup this morning in my honor |
# |
Mar 11th 2019, 14:20 |
josbeir |
:cookie: |
# |
Mar 11th 2019, 14:20 |
ricksaccous |
Hello! my waffle eating friend :relieved: |
# |
Mar 11th 2019, 14:19 |
josbeir |
HELLO @ricksaccous ! :shrug: |
# |
Mar 11th 2019, 14:17 |
ricksaccous |
shnappppppp |
# |
Mar 11th 2019, 14:17 |
ricksaccous |
what's up homies i'm back up in the mixxxxxxxxxxx |
# |
Mar 11th 2019, 14:16 |
ricksaccous |
:face_with_hand_over_mouth: |
# |
Mar 11th 2019, 14:06 |
neon1024 |
:man-gesturing-ok: |
# |
Mar 11th 2019, 13:29 |
josbeir |
:shrug: |
# |
Mar 11th 2019, 13:29 |
alexdd55 |
:man-shrugging: |
# |
Mar 11th 2019, 13:29 |
alexdd55 |
i guess he means something like weight 7 is closest to 5 out of [ 11, 7, 37456, 1] |
# |
Mar 11th 2019, 13:28 |
josbeir |
sort the collection by weight and 'take' an item from it |
# |
Mar 11th 2019, 13:27 |
josbeir |
what do you mean by closes weight |
# |
Mar 11th 2019, 12:30 |
rudy1976s |
I need some help with collection: I have a collection containg some values, let's think about weights: I have a weight and to find the closest in the collection: is there something alreay available or need to create somethin |
# |
Mar 11th 2019, 12:29 |
rudy1976s |
good afternoon to all! |
# |
Mar 11th 2019, 11:58 |
inoas |
jose_zap back |
# |
Mar 11th 2019, 11:58 |
alexdd55 |
and copy phpunit.xml.dist -> phpunit.xml |
# |
Mar 11th 2019, 11:58 |
alexdd55 |
downgrading the phpunit version helped |