# |
Feb 3rd 2018, 21:04 |
davinci |
https://stackoverflow.com/questions/48602025/how-to-get-params-from-query-object-in-cakephp-3 |
# |
Feb 3rd 2018, 21:04 |
hmic |
https://book.cakephp.org/3.0/en/orm/behaviors/tree.html |
# |
Feb 3rd 2018, 21:04 |
hmic |
well, change the one you've got accordinly |
# |
Feb 3rd 2018, 21:04 |
hmic |
you first create a table that holds that tree structure |
# |
Feb 3rd 2018, 21:03 |
ahmed_bodi |
how would i do that with my queries? |
# |
Feb 3rd 2018, 21:03 |
hmic |
use a tree structure? |
# |
Feb 3rd 2018, 21:03 |
ahmed_bodi |
anyone know of any solutions? |
# |
Feb 3rd 2018, 21:03 |
ahmed_bodi |
now any more than one and i get a null object, i believe reading from github its due to the same alias for each field |
# |
Feb 3rd 2018, 21:02 |
ahmed_bodi |
Basically get the next 3 nested referrers |
# |
Feb 3rd 2018, 21:02 |
ahmed_bodi |
So im trying to run a query like this $this->Users->get($id, ['contain' => ['Referrer', 'Referrer.Referrer', 'Referrer.Referrer']]); |
# |
Feb 3rd 2018, 21:02 |
ahmed_bodi |
I've got users object with a relationship to itself on a different field |
# |
Feb 3rd 2018, 21:01 |
ahmed_bodi |
HI guys, im wondering if anyones got any experience with anything like this |
# |
Feb 3rd 2018, 20:23 |
greenjam94 |
Ok, I'll look into it |
# |
Feb 3rd 2018, 20:19 |
hmic |
greenjam94: use friendsofcake/bootstrap-ui plugin if you want to use bootstrap |
# |
Feb 3rd 2018, 20:16 |
greenjam94 |
Hi, does anyone have experience with making forms look good? I am not using cake default css, but bootstrap 3.3.7 |
# |
Feb 3rd 2018, 18:36 |
hmic |
sayed: thanks. good you found it! |
# |
Feb 3rd 2018, 18:25 |
sayed |
It was because that row was soft deleted …. |
# |
Feb 3rd 2018, 18:25 |
sayed |
By the way, the issue i was having earlier, i found the real reason of the error, to whom it may concern. |
# |
Feb 3rd 2018, 18:06 |
kailas |
https://gist.github.com/kailasnarendran/87b59208b2305fd549b47afa80f8c31a This has working and non-working code |
# |
Feb 3rd 2018, 18:04 |
kailas |
why doesn’t the associated term make the associated join table save? |
# |
Feb 3rd 2018, 18:03 |
kailas |
geeez,rather than saving the TaxItem with [‘associated’=>[‘TaxItemX3Invoice’], I tried saving the _joinData specifically $TaxItemsX3Invoices->save($ti->_joinData) and it works |
# |
Feb 3rd 2018, 18:01 |
sayed |
Thanks anyways !! |
# |
Feb 3rd 2018, 18:00 |
sayed |
no idea why it was dying/passing on the initial one |
# |
Feb 3rd 2018, 18:00 |
slackebot |
see that hte joinData is being set to the right value, and the save doesn’t generate any errors. however, the value saved to my table is 0 (rather than the 23.25 calculated). i’m guessing i’m just not doing the right save? any thoughts? |
# |
Feb 3rd 2018, 18:00 |
kailas |
I’ve always been a bit challenged when it comes to saving data to a join table. I’ve got a pretty simple sample now that is not working as I would expect. see https://gist.github.com/anonymous/08e620154ea7bd30fe59291179b80eab X3Invoices->belongToMany(‘TaxItems’). In my X3Invoice entity, i have a method to recalculate taxes. I’m looping through tax items, and calculating the tax (_joinData->amount) for each. in my debug sta |
# |
Feb 3rd 2018, 18:00 |
sayed |
…. |
# |
Feb 3rd 2018, 18:00 |
sayed |
it did validate on the next attempt of inserting data |
# |
Feb 3rd 2018, 18:00 |
sayed |
but by inserting a new row of data |
# |
Feb 3rd 2018, 18:00 |
sayed |
I had cleared the cache a couple of times but that wasnt it |
# |
Feb 3rd 2018, 18:00 |
sayed |
hmm thanks but i think i kinda fixed it (by doing nothing) ,:) |
# |
Feb 3rd 2018, 17:57 |
hmic |
you should rather show your table i think |
# |
Feb 3rd 2018, 17:56 |
hmic |
sayed: i can't see anything on that piece of code |
# |
Feb 3rd 2018, 17:52 |
popperz0r |
anyone knows how to add model associations to Cakedc\Users? |
# |
Feb 3rd 2018, 17:33 |
sayed |
https://gist.github.com/anonymous/29c3f8413286d46524ea7b372c82d2c3 |
# |
Feb 3rd 2018, 17:32 |
sayed |
Any ideas are welcome :slightly_smiling_face: ! |
# |
Feb 3rd 2018, 17:32 |
slackebot |
return $this->error($e, !empty($this->entity) ? $this->entity->getErrors() : []); } }``` |
# |
Feb 3rd 2018, 17:32 |
sayed |
``` public function add() { try { $this->entity = $this->items->newEntity(); $this->entity = $this->items->patchEntity($this->entity, $this->getData()); if (!$this->items->save($this->entity)) { throw new Exception('The ' . $this->name . ' could not be saved. Please, try again.'); } $this->set('item', $this->entity); } catch (Exception $e) { |
# |
Feb 3rd 2018, 17:32 |
sayed |
I am patching the entity just based on the requested data, nothing special going on there. |
# |
Feb 3rd 2018, 17:27 |
sayed |
https://gist.github.com/SayedShahidi/70ea73a2f02c088ddbfc64673ae380e1 |
# |
Feb 3rd 2018, 17:25 |
sayed |
https://gist.github.com/SayedShahidi/5be6b8ce4acc29750e7685d7ec7b08bb |
# |
Feb 3rd 2018, 17:24 |
hmic |
!tell sayed about gist |