Log message #4125903

# At Username Text
# Mar 17th 2018, 14:49 jeremyharris addNested doesn’t accept a “rule” or “on” or “message”, those are reserved for the rules in the nested validator
# Mar 17th 2018, 14:48 jeremyharris ok
# Mar 17th 2018, 14:48 jeremyharris alternatively (and maybe more clear), you can just implement the nested logic yourself, and put the conditions there.
# Mar 17th 2018, 14:47 kitcat711 https://gist.github.com/Kitcat711/441b2dd5b6b302d5db7a1f828e3ec922
# Mar 17th 2018, 14:47 kitcat711 this is what I tried
# Mar 17th 2018, 14:47 jeremyharris you might need to instruct it to be the last for that field, so the nested rules don’t run by default: https://book.cakephp.org/3.0/en/core-libraries/validation.html#marking-rules-as-the-last-to-run
# Mar 17th 2018, 14:45 jeremyharris have you tried something like `->allowEmpty('property', function ($context) { // return condition })` the add the nested below
# Mar 17th 2018, 14:44 kitcat711 if the field is true, then I must validated an array
# Mar 17th 2018, 14:43 kitcat711 property
# Mar 17th 2018, 14:43 kitcat711 condition is a field of the propert
# Mar 17th 2018, 14:41 jeremyharris or, add a rule for the actual property that has the nested array
# Mar 17th 2018, 14:41 jeremyharris what kind of condition? the nested validation rules could handle those
# Mar 17th 2018, 14:40 kitcat711 i've been trying without success
# Mar 17th 2018, 14:40 kitcat711 using cake 3.5, in $validator is it possible to ->addNested on a condition?
# Mar 17th 2018, 14:39 kitcat711 hello
# Mar 17th 2018, 14:39 bakro.istvan @dereuromark
# Mar 17th 2018, 14:31 spencdev gist it
# Mar 17th 2018, 14:23 Guest74853 hi everyone. i'm having trouble in passing the value of a select control to the controller when form is posted
# Mar 17th 2018, 14:22 dereuromark it should be yeah
# Mar 17th 2018, 14:19 bakro.istvan Is the "pivot" table accessible from these two model/controller?
# Mar 17th 2018, 14:19 bakro.istvan Yes, what I tought. Just to be clear I have users, pics, users_pics table and UsersTable, PicsTable and UsersController, PicsController
# Mar 17th 2018, 14:16 dereuromark this shouldnt delete the linked main records
# Mar 17th 2018, 14:15 dereuromark Simple delete on the pivot table
# Mar 17th 2018, 14:15 bakro.istvan However it brings my next question: How to remove a link?
# Mar 17th 2018, 14:14 bakro.istvan append does work
# Mar 17th 2018, 14:13 adithya *what am i missing?
# Mar 17th 2018, 14:12 adithya *added
# Mar 17th 2018, 14:12 adithya so, i just wanted to ask this! a very beginner question, i just addes the auth component but all my pages are accessible, just wondering what i am missing?
# Mar 17th 2018, 14:10 dereuromark does append strategy work?
# Mar 17th 2018, 14:10 dereuromark ah, so its not a simple habtm
# Mar 17th 2018, 14:05 bakro.istvan "dont repost the payload for the pics, just attach the _ids you wanna save." --> I would post only the _ids, but my join records do have attributes.
# Mar 17th 2018, 13:56 dereuromark same ideas
# Mar 17th 2018, 13:56 dereuromark dont repost the payload for the pics, just attach the _ids you wanna save. tip: look into my tags plugin and how it deals with adding to existing ones.
# Mar 17th 2018, 13:55 bakro.istvan the posted data looks like this: { pics: [ {id: 2, _joinData: {type: "profile"}} ] }
# Mar 17th 2018, 13:54 dereuromark also you can manually add into that table, that way you go around the habtm magic completely
# Mar 17th 2018, 13:54 dereuromark see the docs, you can change the strategy from replace to append
# Mar 17th 2018, 13:53 bakro.istvan I would like to do that, but if I POST the new link to /users/edit/1, the old link will be deleted and only the new will be there. _This action is baked in console._
# Mar 17th 2018, 13:51 dereuromark just add a new entry then in this pivot table
# Mar 17th 2018, 13:50 bakro.istvan sorry, i meant habtm
# Mar 17th 2018, 13:46 dereuromark in this case copy over might be easier now
# Mar 17th 2018, 13:46 dereuromark then you should have used habtm :slightly_smiling_face: a pivot table