Log message #3938598

# At Username Text
# Sep 27th 2016, 16:01 hmic !tell froodley about ask
# Sep 27th 2016, 16:01 froodley anyone active?
# Sep 27th 2016, 15:42 ypnos you're welcome
# Sep 27th 2016, 15:41 prophet Wow. This is amazing. It works. Thank you so much sir. I see now that it needs the user_id to match the right user, I thought this is done by the order.
# Sep 27th 2016, 15:37 ypnos validate => false is not needed for the call to save()
# Sep 27th 2016, 15:36 ypnos that's it
# Sep 27th 2016, 15:36 ypnos second, you need to add <?= $this->Form->hidden("users.$i.id") ?>
# Sep 27th 2016, 15:35 ypnos so you don't have to initialize and increment $i
# Sep 27th 2016, 15:35 ypnos you can do foreach ($association->users as $i => $user)
# Sep 27th 2016, 15:35 ypnos yeah two comments
# Sep 27th 2016, 15:33 prophet http://pastebin.com/UWFSyyWE
# Sep 27th 2016, 15:33 prophet Here you can roughly see my code
# Sep 27th 2016, 15:29 ypnos you still have the mindset as if your join table is an entity by itsel
# Sep 27th 2016, 15:29 ypnos this is how cake sees it
# Sep 27th 2016, 15:29 ypnos in your mind, you need to see it as patching the user, passing joinData along (and situationally, you don't patch any of the user's fields)
# Sep 27th 2016, 15:28 ypnos do not provide any ids within the join data
# Sep 27th 2016, 15:28 ypnos you provide the id of the user next to the _joinData, on the same level
# Sep 27th 2016, 15:27 ypnos http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-data-to-the-join-table
# Sep 27th 2016, 15:27 ypnos what you would need to do is like in the tags example
# Sep 27th 2016, 15:27 ypnos that doesn't make sense to me
# Sep 27th 2016, 15:27 prophet Next to 'rank' there are 3 hidden fields that I added, id, user_id, association_id
# Sep 27th 2016, 15:26 ypnos show us what you did
# Sep 27th 2016, 15:26 prophet I did.
# Sep 27th 2016, 15:26 ypnos so that the data appears connected to the right user
# Sep 27th 2016, 15:26 ypnos you need to provide the user's id as a hidden field
# Sep 27th 2016, 15:25 prophet I did what you said. Now I have two additional users.
# Sep 27th 2016, 15:22 ypnos also see http://book.cakephp.org/3.0/en/orm/validation.html#using-different-validators-per-association
# Sep 27th 2016, 15:21 ypnos just say 'associated' => ['Users' => ['validate' => false],
# Sep 27th 2016, 15:21 ypnos no
# Sep 27th 2016, 15:21 ypnos and first level associations are automatically included btw. see http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities
# Sep 27th 2016, 15:21 prophet Okay. Should I change it to 'Users._joinData'?
# Sep 27th 2016, 15:20 ypnos prophet: ['associated' => ['Users'] this states you are patching user
# Sep 27th 2016, 15:20 ypnos prophet: because you are patching user! you just don't know it
# Sep 27th 2016, 15:20 tiagoa How do implement beforeFind in cakephp 3? Have I do a EventListener???? like this: http://book.cakephp.org/3.0/en/orm/table-objects.html#initialize?
# Sep 27th 2016, 15:20 prophet Why are the validation rules even applied? I want to patch the data that is associated to user and not user
# Sep 27th 2016, 15:20 GuillaumeP hello guys -- I've got one short question : if, for any reason, sending an email fails, what type of exception should I catch ?
# Sep 27th 2016, 15:19 ypnos well then you have to either (a) specify that the user should not be validated or (b) have a different set of validation rules for your case
# Sep 27th 2016, 15:18 prophet For the user, yes. But I am not realy editing the user but a field of the membership table. The membership table does not have validation rules.
# Sep 27th 2016, 15:18 ypnos you can remove the "$association = " part of that
# Sep 27th 2016, 15:17 ypnos well do you have validation rules that an email must be provided?
# Sep 27th 2016, 15:14 prophet This is how the call looks like $association = $this->Associations->patchEntity($association, $this->request->data, ['associated' => ['Users']]);