Log message #4099943

# At Username Text
# Nov 30th 2017, 15:13 kaliel is /src a good choice ?
# Nov 30th 2017, 15:13 kaliel hey guys, i'd like to know where's the best place / the place you use, to store frontend dev files (scss, es6, etc..) in a cake project ?
# Nov 30th 2017, 15:01 neon1024 Sure you can, but you’ll need to manually marshal them
# Nov 30th 2017, 14:59 obinoob neon1024 hold on, so i can't have inputs named like: name, address, district_id, town_id ??
# Nov 30th 2017, 14:52 AlexMax Question - is there some easy way to hydrate the invisible 'rowid' row when using sqlite3?
# Nov 30th 2017, 14:50 neon1024 Do bear in mind that singular associations will be automatically marshalled only if the form name is singular as well, so the array matches the entity properties
# Nov 30th 2017, 14:49 neon1024 As you’d be expecting `$this->Form->control('addresses.0.street')` etc
# Nov 30th 2017, 14:49 neon1024 Then either you have a bug, most likely you’ve not repeated the ‘associated’ key in the array. Or your request data array isn’t correct, which would be down to bad form naming
# Nov 30th 2017, 14:47 obinoob neon1024 I've taken from here https://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities
# Nov 30th 2017, 14:46 obinoob neon1024 actually I have done before you pointed that still the entity doesn't get filled https://gist.github.com/obinoob/8d833962e3a167143b38a5f5697209c9
# Nov 30th 2017, 14:35 neon1024 Then as @admad suggested, `var_dump()` the resulting entity to ensure that you have nested entities :slightly_smiling_face:
# Nov 30th 2017, 14:33 neon1024 Or you can use dot notation if that’s your flavour
# Nov 30th 2017, 14:33 neon1024 Then you might want to declare them in your patchEntity, as `->patchEntity($entity, $this->request->getData(), ['associated' => ['Addresses' => ['associated' => ['Disctricts', 'Towns']]]])`
# Nov 30th 2017, 14:32 obinoob neon1024 yes I believe so, see clients -> addresses -> [districts, towns]
# Nov 30th 2017, 14:21 admad to debug first ensure you have entities for the hasmany records after patching and not arrays
# Nov 30th 2017, 14:20 neon1024 obinoob, Are the associations more than 1 table deep?
# Nov 30th 2017, 13:33 obinoob regarding to my issue does anyone knows why hasMany association if failing to updated associated entities? I think this is somehow a required fk issue...
# Nov 30th 2017, 13:27 obinoob h.mavisakalian np if it helped is what matters ;)
# Nov 30th 2017, 13:13 h.mavisakalian His method worked
# Nov 30th 2017, 13:13 h.mavisakalian @obinoob (IRC) thanks too
# Nov 30th 2017, 13:11 obinoob johnwayne not sure if it is of much help but take a read here https://book.cakephp.org/3.0/en/orm/query-builder.html#aggregates-group-and-having
# Nov 30th 2017, 13:04 h.mavisakalian Worked like a charm
# Nov 30th 2017, 13:04 h.mavisakalian @johnwayne Thanks man
# Nov 30th 2017, 13:00 johnwayne so you can use normal find, and at the end ->first() then you will get same datastructure like with get(...)
# Nov 30th 2017, 12:59 johnwayne $postUpdate = $postsTable->findByPostId($post[‘id’])->toArray();
# Nov 30th 2017, 12:58 h.mavisakalian get()
# Nov 30th 2017, 12:58 h.mavisakalian it only works when I use ->grt()
# Nov 30th 2017, 12:58 h.mavisakalian with entity it gives me the error I mentioned
# Nov 30th 2017, 12:58 h.mavisakalian then I can’t do this $postUpdate->likes = $post[‘likes’][‘count’]; $postsTable->save($postUpdate);
# Nov 30th 2017, 12:57 obinoob so use find and where whats the deal?
# Nov 30th 2017, 12:57 h.mavisakalian ->get() only works with a id (primary) which I don’t have at that point so I need to fetch it from the database
# Nov 30th 2017, 12:56 h.mavisakalian but its wrong… and even I can see that
# Nov 30th 2017, 12:56 h.mavisakalian It works this way…
# Nov 30th 2017, 12:56 h.mavisakalian $postUpdate = $postsTable->find()->where([ ‘postid’ => $post[‘id’] ]); $postUpdate = $postUpdate->toArray(); $postUpdate = $postsTable->get($postUpdate[0][‘id’]); $postUpdate->likes = $post[‘likes’][‘count’]; $postsTable->save($postUpdate);
# Nov 30th 2017, 12:55 h.mavisakalian look
# Nov 30th 2017, 12:55 obinoob h.mavisakalian so what do you want to achieve now? you need to be pragmatic when naming variables... it's makes your code readable I'm not very good with that either but that is very important
# Nov 30th 2017, 12:54 h.mavisakalian Sorry if this is frustrating for you all :slightly_smiling_face:
# Nov 30th 2017, 12:53 johnwayne How can I group query by month and year -> https://pastebin.com/QWcUF3AT
# Nov 30th 2017, 12:52 h.mavisakalian It works with get() when I fetch the data as you told me, get the ID from the array and then use get() with the ID
# Nov 30th 2017, 12:51 h.mavisakalian Yes I did…
# Nov 30th 2017, 12:51 h.mavisakalian $postUpdate = $postsTable->find()->where([ ‘postid’ => $post[‘id’] ]); $postUpdate->likes = $post[‘likes’][‘count’]; $postsTable->save($postUpdate);