Log message #4152481

# At Username Text
# Jun 19th 2018, 14:12 neon1024 Perhaps it just needs `return $query->where(['Bids.prix' => $query->func()->max('Bids.prix')]);` ?
# Jun 19th 2018, 14:11 kaliel @neon1024 Thanks, but it didn't do the trick :S
# Jun 19th 2018, 14:11 neon1024 Why is it that when I post to my method, which has `$this->getRequest()->allowMethod('post');` I get a Method Not Allowed exception?! I’m using the correct method
# Jun 19th 2018, 14:08 LubosR Was thinking that problem could be with foreign keys and/or indexes, but checked and I did not set offer_type_id as foreign key neither index
# Jun 19th 2018, 14:07 LubosR I am messy when trying to quickly solve :) but good piont :)
# Jun 19th 2018, 14:06 neon1024 That’s my excuse anyway :P
# Jun 19th 2018, 14:06 neon1024 Ah well, no idea. Your code is pretty messy, so it’s hard to follow
# Jun 19th 2018, 14:05 neon1024 Unless you use it’s original value elsewhere of course
# Jun 19th 2018, 14:05 neon1024 Btw you can replace all that offerType combine with just find(‘list’)
# Jun 19th 2018, 14:05 LubosR With this migration script I am trying to avoid associations
# Jun 19th 2018, 14:04 neon1024 In your database
# Jun 19th 2018, 14:04 neon1024 So you have offers.offer_type_id right?
# Jun 19th 2018, 14:04 neon1024 You’re in Offers
# Jun 19th 2018, 14:04 LubosR And value = 4 which is never saved :(
# Jun 19th 2018, 14:04 LubosR Checked DB field type and it is integer, same what I am passing into entity
# Jun 19th 2018, 14:03 LubosR Nope, as you might see at the image, there is 'offer_type_id' => (int) 4
# Jun 19th 2018, 14:03 neon1024 Could just be that the value you’re trying to write is empty
# Jun 19th 2018, 14:02 LubosR In case anyone else want to help me to solve this puzzle, here is my debugging screenshot https://pasteboard.co/HqCHmKh.png (code, debug output, sql output = with no offer_type_id!!)
# Jun 19th 2018, 13:56 LubosR neon1024 thanks for discussion, i tried again with patchEntity and checking errors, isDirty and even when all looks good it is not saved. Have to leave it open for now, but what a mystery, right? :)
# Jun 19th 2018, 13:56 neon1024 File uploaded https://cakesf.slack.com/files/U1BT622HW/FB9JEFW3B/find_bids_by_maximum_price.php / https://slack-files.com/T053DPNCM-FB9JEFW3B-27d07b5c15
# Jun 19th 2018, 13:55 neon1024 I don’t think this will work, but first attempt
# Jun 19th 2018, 13:55 tierrarara slackebot - cakebot3 thanks for your answer
# Jun 19th 2018, 13:45 kaliel I'm stuck from hours on the last part (subquery)
# Jun 19th 2018, 13:44 kaliel File uploaded https://cakesf.slack.com/files/U38NH0S01/FBA1SCJ1Z/-.sql / https://slack-files.com/T053DPNCM-FBA1SCJ1Z-62c9be32f5
# Jun 19th 2018, 13:44 kaliel Hi everyone, i'm stuck in trying to make a query with cake's query builder, if anyone can help me :slightly_smiling_face: Here is what's working in sql :
# Jun 19th 2018, 13:40 neon1024 If it’s not any of those ideas, then unfortunatly, I’ve run out!
# Jun 19th 2018, 13:40 LubosR neon1024 thanks, trying again (feeling like I tried all of those)
# Jun 19th 2018, 13:39 LubosR just did $conn->logQueries(true) to find out how insert look like and offer_type_id is not there.
# Jun 19th 2018, 13:38 neon1024 ..because it will assume you have an OfferTypes associated table class
# Jun 19th 2018, 13:38 neon1024 As Cake will bake a rule for that
# Jun 19th 2018, 13:38 neon1024 Also ensure that your save has `['checkRules' => false]` as you might have a rule if you have a baked table
# Jun 19th 2018, 13:37 neon1024 Or, use patchEntity, and check `$entity->getErrors()`
# Jun 19th 2018, 13:37 neon1024 You could check too `$entity->isDirty('offer_type_id')` I think the method is called
# Jun 19th 2018, 13:36 neon1024 As long as you set it with `$entity->set('offer_type_id', $offerId)`, it should be fine
# Jun 19th 2018, 13:36 neon1024 It shouldn’t exclude them unless there is a defined association
# Jun 19th 2018, 13:34 LubosR What a mystery :)
# Jun 19th 2018, 13:28 LubosR https://pasteboard.co/HqCtpZz.png here is method (it is shell which should read data from one connection and resave to other)
# Jun 19th 2018, 13:27 LubosR So wondering if ORM does exclude fields _id somehow
# Jun 19th 2018, 13:27 LubosR I did and no error, data are saved exclude this offer_type_id
# Jun 19th 2018, 13:26 tim Did you save the changed entity?
# Jun 19th 2018, 13:25 LubosR Firstly i did newEntity and then each field set by $entity->set(), now I am trying to pass $data as array to newEntity method