Log message #3923117

# At Username Text
# Aug 25th 2016, 20:25 saliak Iâ??ve got a HABTM relationship between two tables, through a join table (https://gist.github.com/anonymous/7a2387f18bfa16680505ca5b8244bd39). For some reason itâ??s working one direction (products->orders), but not the other way (canâ??t get a list of products associated with an order). I get the error that â?? Unknown column 'OrderLines.product_id' in 'field listâ??â?, suggesting that cake isnâ??t using the foreign/binding key names in my definition in
# Aug 25th 2016, 20:12 hytromo Yes it is :slightly_smiling_face:
# Aug 25th 2016, 20:12 shealyw2 it should be hakermania
# Aug 25th 2016, 20:12 hakermania test: is an irc msg visible in slack
# Aug 25th 2016, 18:49 philipgrey any thoughts?
# Aug 25th 2016, 18:43 graziel nope, it gives path where data will be sent by browser so no function calling
# Aug 25th 2016, 18:39 marquesf @graziel i can call my add function in url right? :)
# Aug 25th 2016, 18:33 graziel @marquesf you can pass 'url' to Form->create ie $this->Form->create($contact, ['url' => ['controller' => 'Home', 'action' => 'contact']])
# Aug 25th 2016, 18:31 marquesf im feeling im close to do my contatc form with cells, but i dont understand how to submit my form. https://gist.github.com/anonymous/ddc7e7a0c4e95b7483520df6cdfe2e25
# Aug 25th 2016, 18:26 btx maybe Iâ??ve just been on this task too long and canâ??t think of a different way to approach things
# Aug 25th 2016, 18:25 btx weâ??re using valid property mutators to change the fields before persistence, but we have no option for changing the validator without newEntity/patchEntity
# Aug 25th 2016, 18:23 btx what if we conditionally add meta-data to an entity that only the Table needs to know about, because Controllers should be dumb, that needs to be valid in order to save, but is not part of the default validation for some reason
# Aug 25th 2016, 18:21 btx or, less destructively, `$entity->user_id = $this->AuthUser->id;`
# Aug 25th 2016, 18:20 btx @admad is there anything illegal about the following ``` $entity = $this->Foos->newEntity($this->request->data()); unset($entity->title); ```
# Aug 25th 2016, 18:12 admad You have already gone wrong when you find the need to validate an entity
# Aug 25th 2016, 18:09 btx actually. iâ??ll just slap a method on AppTable for now lol
# Aug 25th 2016, 18:09 btx `$entry = $this->patchEntity($entry, $entry->toArray(), ['validate'=>'consume']);` seems a lot to just get an entity to revalidate, but thatâ??s a struggle for another day
# Aug 25th 2016, 18:08 btx +1, u rock
# Aug 25th 2016, 18:08 graziel no problem glad i could help : )
# Aug 25th 2016, 18:07 btx now to clean up all this frenzied mess i made
# Aug 25th 2016, 18:07 btx @graziel, it worked :slightly_smiling_face: thanks!
# Aug 25th 2016, 18:06 btx Houston, we have persistence
# Aug 25th 2016, 18:05 btx holy flip. at long last
# Aug 25th 2016, 18:03 graziel bah wrong `patchEntity($entry, $entry->toArray(), ['validate' => 'consume']);`
# Aug 25th 2016, 18:02 graziel in table
# Aug 25th 2016, 18:02 btx like $entity->validate(â??consumeâ??);
# Aug 25th 2016, 18:02 graziel and then `$entry = $this->patchEntity($entry->toArray(), ['validate' => 'consume']);`
# Aug 25th 2016, 18:02 btx and then is there a way to take an entity and revalidate it without creating another entity?
# Aug 25th 2016, 18:01 graziel ah then well you need to `$entry = $this->BucketEntries->newEntity($this->request->data, ['validate' => false]); in controller
# Aug 25th 2016, 18:01 btx the idea is that the Table should know how itâ??s data needs to be stored and tweaked, and the Controller just needs to know what Table function it should be talking to
# Aug 25th 2016, 18:01 btx yeah I want to do it in the Table tho - otherwise the controller is required to know more about the internal processing than it should
# Aug 25th 2016, 18:00 btx i want to only call `validate => â??consumeâ??`
# Aug 25th 2016, 18:00 graziel cause you dont set it in $entry = $this->BucketEntries->newEntity($this->request->data);
# Aug 25th 2016, 18:00 graziel btx im kind of lost what you want to do : ), you dont want to call validation at all? or call ['validate'=>'consume'] ?
# Aug 25th 2016, 17:57 btx agh poop haha itâ??s almost identical to `purchase` i pasted the wrong one - only diff is the `ENTRY_TYPE` that gets set
# Aug 25th 2016, 17:57 graziel yeah but i dont see body of consume
# Aug 25th 2016, 17:56 btx o
# Aug 25th 2016, 17:56 btx no, the `newEntity` line right above (line 8)
# Aug 25th 2016, 17:56 graziel and how do you add this data? maybe using patchEntity? : )
# Aug 25th 2016, 17:55 btx instead of requiring the controllers to be aware of underlying model logic
# Aug 25th 2016, 17:55 btx to keep my models fat and happy and my controllers lean and clean