Log message #4125948

# At Username Text
# Mar 17th 2018, 16:06 kitcat711 like "not before" "must be after"
# Mar 17th 2018, 16:06 kitcat711 you can by driving for validation based on date
# Mar 17th 2018, 16:05 jeremyharris any time!
# Mar 17th 2018, 16:05 kitcat711 thanks for helping :)
# Mar 17th 2018, 16:04 jeremyharris :+1:
# Mar 17th 2018, 16:04 kitcat711 due to my logical process afterward
# Mar 17th 2018, 16:03 kitcat711 jeremy : dont take any further time on it: i found another good reason to avoid it
# Mar 17th 2018, 16:01 kitcat711 thx
# Mar 17th 2018, 15:59 jeremyharris gimme a few mins :slightly_smiling_face:
# Mar 17th 2018, 15:58 jeremyharris hm I’m going to try and work something up real quick to see if I can figure it out for you
# Mar 17th 2018, 15:58 kitcat711 taht kills my errors methods :(
# Mar 17th 2018, 15:58 kitcat711 @jeremy => btw, validation on a boolean for the nested => error [_nested] => The provided value is invalid
# Mar 17th 2018, 15:26 bakro.istvan @dereuromark I found this: https://api.cakephp.org/3.5/source-class-Cake.ORM.Association.BelongsToMany.html#580-615 but there is no way to pass a conditions array. Is there any other implementation?
# Mar 17th 2018, 15:26 jeremyharris alright, good luck!
# Mar 17th 2018, 15:25 kitcat711 thx jeremyharris , I keep trying
# Mar 17th 2018, 15:21 kitcat711 ok
# Mar 17th 2018, 15:19 jeremyharris it should be in the context of that nested rule
# Mar 17th 2018, 15:18 kitcat711 ok, how can I access the 'wihCAF' field which is out of my context at that time?
# Mar 17th 2018, 15:17 jeremyharris so instead of using addNested, use the `->add()` on line 422 and add your conditions in the rule closure
# Mar 17th 2018, 15:15 jeremyharris you may need to just re-implement it: https://api.cakephp.org/3.5/source-class-Cake.Validation.Validator.html#402-435
# Mar 17th 2018, 15:15 jeremyharris hmm
# Mar 17th 2018, 15:15 jeremyharris oh I didn’t notice withCAF and caf were two different fields
# Mar 17th 2018, 15:15 kitcat711 and 'withCaf' is a boolean to inform if we nedd to take 'caf' into account
# Mar 17th 2018, 15:14 kitcat711 actually the array is 'caf' which exist anyway
# Mar 17th 2018, 15:04 adithya i don't know whats causing that
# Mar 17th 2018, 15:03 adithya @ricksaccous thank you, seems to be an issue with server the auth component works when i use bin/cake server but from my nginx setup it's not working
# Mar 17th 2018, 15:02 jeremyharris if your rule returned `true` when withCAF is false, that means no error. addNested won’t run on it because it’s not an array
# Mar 17th 2018, 15:01 kitcat711 hum, that would return an error if withCAF is false
# Mar 17th 2018, 14:59 ricksaccous @adithya all controllers extend app controller so you already added auth to all controllers
# 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)