Log message #4199182

# At Username Text
# Aug 21st 2019, 13:11 admad i abore the js frameworks ecosystem
# Aug 21st 2019, 13:09 ricksaccous haha yeah i pretty much only do jquery work as well, haven't touched vuejs or any js framework either
# Aug 21st 2019, 13:08 admad i only do jquery work and have done bit of vuejs :slightly_smiling_face:
# Aug 21st 2019, 13:00 ricksaccous @admad have you ever worked on js heavy projects? you seem to work on a ton of back end work
# Aug 21st 2019, 12:58 ricksaccous meh, js problems
# Aug 21st 2019, 12:58 ricksaccous then you would have to make sure your custom submit logic is still bound but that's pretty easy to do
# Aug 21st 2019, 12:57 ricksaccous then you will get your errors as intended every time without having to worry about custom js logic
# Aug 21st 2019, 12:56 ricksaccous another thing to consider doing is re-rendering the whole form after cake has it's way with it
# Aug 21st 2019, 12:55 ricksaccous which i read from and apply to the form
# Aug 21st 2019, 12:55 ricksaccous and removing them where i need them and did set getErrors to a variable
# Aug 21st 2019, 12:55 ricksaccous since i'm using a custom theme i built out some js for plopping errors where i need them
# Aug 21st 2019, 11:49 Nitrogen generally, it's fine UNTIL you NEED something serialized and expect it to 'just work' as implied by documentation. w/o added preconditions. :)
# Aug 21st 2019, 11:48 admad viewBuilder()->setOption('serialize', ...)
# Aug 21st 2019, 11:47 admad setting `_serialize` vs setting the actual view vars is pretty confusing to first time users, which is why I changed it in 4.x where you have to use viewBuilder->setOption('serialize', ...)` instead
# Aug 21st 2019, 11:23 Nitrogen haven't used plugins yet, but will check it out. thanks, dereuromark.
# Aug 21st 2019, 11:23 Nitrogen turns out one has to have a viewVariable set first to be able to serialize it then. that was my problem. checked with _dataToSerialize() in JsonView.php
# Aug 21st 2019, 11:20 dereuromark ajax plugin provides some convenience handling for this by the way.
# Aug 21st 2019, 11:01 Nitrogen yup, exactly what I did. will have to look into nitty-gritty. probably missing something obvious.
# Aug 21st 2019, 10:56 neon1024 `$errors = $entity->getErrors(); $this->set('_serialize', ['errors'])`
# Aug 21st 2019, 10:56 Nitrogen hm, capturing errors into variable and serializing that didn't work though. just gives me null. while debug() clearly shows it's not empty.
# Aug 21st 2019, 10:55 Nitrogen it does appear so, yes.
# Aug 21st 2019, 10:54 neon1024 I think the built-in exception renderer does work for json, but I think it only renders exceptions, and not entity errors
# Aug 21st 2019, 10:33 Nitrogen Sort of in the same vein as _serialize just works automagically.
# Aug 21st 2019, 10:32 Nitrogen I will actually try that now. But thing is there's some sort of built-in exception renderer which takes care of internal cake errors - like missing data-view templates. So I was hoping there's a way to tap into that by adhering to some convention.
# Aug 21st 2019, 10:27 neon1024 If I need them I tend to set an errors variable and pass that to _serialize
# Aug 21st 2019, 10:26 Nitrogen spriz, that's neat, thanks!
# Aug 21st 2019, 10:21 spriz or build something alike: https://github.com/FriendsOfCake/crud/blob/master/src/Error/ExceptionRenderer.php
# Aug 21st 2019, 10:20 spriz Nitrogen: The easy way could be to use the Crud ExceptionRenderer
# Aug 21st 2019, 10:19 Nitrogen hey, guys. how would one go about getting validation errors after asynchronous submit? [error] property is not exposed through _serialize. do I manually check getErrors() and build my response manually?
# Aug 21st 2019, 10:00 eax :P
# Aug 21st 2019, 10:00 spriz stupid duckduckgo led me to other one :)
# Aug 21st 2019, 09:59 spriz that is for 3.x
# Aug 21st 2019, 09:59 spriz Ah yes, FoC one
# Aug 21st 2019, 09:59 eax Neat!
# Aug 21st 2019, 09:59 eax I think it’s this one: https://github.com/FriendsOfCake/fixturize Right?
# Aug 21st 2019, 09:58 spriz will only tear down stuff if it is changed
# Aug 21st 2019, 09:58 eax Nice! Thanks @spriz :)
# Aug 21st 2019, 09:58 spriz will go meep meep
# Aug 21st 2019, 09:58 spriz https://github.com/lorenzo/cakephp-fixturize
# Aug 21st 2019, 09:58 spriz @eax Fixturize it!
# Aug 21st 2019, 09:57 eax Hmm, I’m gonna see if I can cut anything down, but I don’t think so :S