Log message #4125919

# At Username Text
# Mar 17th 2018, 14:58 jeremyharris return true if false, false if empty array
# Mar 17th 2018, 14:58 jeremyharris then the “last” rule should be a custom rule
# Mar 17th 2018, 14:58 kitcat711 adding it in the $validator will return an error if the value is false
# Mar 17th 2018, 14:58 kitcat711 the point is: 'caf' can be false and that is not an error neither
# Mar 17th 2018, 14:56 jeremyharris you’ll have to tweak it to match your conditions, but basically if it fails that rule, it shouldn’t run anymore rules for “caf” including the nested ones
# Mar 17th 2018, 14:55 kitcat711 ok, willl try the "last rule" option
# Mar 17th 2018, 14:55 jeremyharris I added a comment for what I was thinking as the first suggestion
# Mar 17th 2018, 14:52 kitcat711 so I was trying to put the condition on the add nested
# Mar 17th 2018, 14:52 jeremyharris I think either of the options I suggested would still work. either add a “last to run” rule for the caf field itself, or re-implement the actual addNested logic
# Mar 17th 2018, 14:52 kitcat711 yes
# Mar 17th 2018, 14:52 jeremyharris kitcat711 oh I see what you’re doing now, one nested validation has the condition one does not
# Mar 17th 2018, 14:51 jeremyharris adithya: add it anywhere you want auth. usually people add it to AppController then “allow” the public pages (security “on” by default)
# Mar 17th 2018, 14:50 jeremyharris sorry I didn’t mean to imply you couldn’t reuse it, that’s exactly what addNested is great for
# Mar 17th 2018, 14:49 jeremyharris you could re-implement addNested and add your conditions. Just copy and past the ->add() logic, and put your conditions there
# Mar 17th 2018, 14:49 kitcat711 ok, so I can't reuse my paymentValidator
# Mar 17th 2018, 14:49 adithya guys, i just added the auth component in my app controller, and all my pages are from other controllers are accessible, should i add auth component to all my contrllers?
# 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