Log message #3938584

# At Username Text
# 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']]);
# Sep 27th 2016, 15:13 prophet You are right. But when I call patchEntity I get errors because 'email' etc. is missing.
# Sep 27th 2016, 15:12 ypnos why would you want to have other fields in your request data if you didn't change them?
# Sep 27th 2016, 15:11 ypnos that has nothing to do with the joinData though
# Sep 27th 2016, 15:11 ypnos well obviously the request data will only have what you submit in your form
# Sep 27th 2016, 15:10 prophet No, and this seems to be the problem. The request->data only has the attributes that I added as (hidden) form inputs. Every other attribute of the entity is missing.
# Sep 27th 2016, 15:07 ypnos so your stuff looks like this? http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-data-to-the-join-table
# Sep 27th 2016, 15:04 prophet My fault. It should only be one
# Sep 27th 2016, 15:03 ypnos why are there two underscores in your request data?
# Sep 27th 2016, 15:01 prophet Edit: request->data looks like ['users' => '0' => [__joinData => ['rank', etc]], '1' => [__joinData => ['rank', etc]]]
# Sep 27th 2016, 14:57 prophet I had several approaches. I see the most fitting in saving the association with the 'associated' option. I set 'associated' to ['Users']. My request->data looks like ['users' => '0' => ['rank', etc], '1' => 'rank', etc]. As you can see it is missing all other attributes of 'user'.
# Sep 27th 2016, 14:54 ypnos did you try editing the join data?
# Sep 27th 2016, 14:49 prophet two*
# Sep 27th 2016, 14:49 prophet I have to tables (Associations, Users) connected with a 'through'-table (membership). The 'through'-table has an additional attribute 'rank'. I don't see how I can edit the rank. I can access the rank via '_joinData' field of 'users' of the association.
# Sep 27th 2016, 14:44 ypnos I would like to create a template to be replicated in my view instead of having to mangle with it in javascript