# |
Aug 26th 2019, 18:03 |
lpj145 |
when i seach on doc, not found nothing about session_start $_SESSION var wrapper... |
# |
Aug 26th 2019, 18:03 |
lpj145 |
Hello everyone, i maked middleware, but needed to check session data... |
# |
Aug 26th 2019, 17:32 |
inoas |
urgh |
# |
Aug 26th 2019, 17:32 |
inoas |
so slack shows me as jh |
# |
Aug 26th 2019, 17:32 |
inoas |
hm |
# |
Aug 26th 2019, 17:31 |
jh |
@davorminchorov that would be a middleware thing I think... pre-transformation validation, transformation, post-transformation-validation |
# |
Aug 26th 2019, 13:48 |
admad |
i strong suggest you do the CMS tutorial first to understand the basics of using the framework |
# |
Aug 26th 2019, 13:40 |
davorminchorov |
I'll go with patchEntity(), I thought it was related to the model itself, a misunderstanding on my part. Nope, haven't done the CMS tutorial yet, will look into it whenever I get some free time. Learning the framework on the go as I need. Thanks for all the help, I appreciate it. |
# |
Aug 26th 2019, 13:37 |
admad |
why are you not using `patchEntity()` already before saving and entity? :slightly_smiling_face: Have you done the CMS tutorial on the manual? |
# |
Aug 26th 2019, 13:35 |
ricksaccous |
prob makes more sense to just use patchEntity ;) |
# |
Aug 26th 2019, 13:35 |
davorminchorov |
Ah right |
# |
Aug 26th 2019, 13:35 |
ricksaccous |
and redefining the schema/etc |
# |
Aug 26th 2019, 13:35 |
ricksaccous |
as in writing a model-less form class |
# |
Aug 26th 2019, 13:34 |
davorminchorov |
extra work as in writing custom validation rules? |
# |
Aug 26th 2019, 13:34 |
ricksaccous |
well you could but you have to do extra work |
# |
Aug 26th 2019, 13:34 |
ricksaccous |
yeah, patchEntity might be a bit nicer because you get the form magic along with it, that you wouldn't otherwise |
# |
Aug 26th 2019, 13:33 |
davorminchorov |
but I can do the same with the form objects as well |
# |
Aug 26th 2019, 13:33 |
davorminchorov |
I guess I could use the patchEntity() method to validate the request before sending the data for saving in the queue itself |
# |
Aug 26th 2019, 13:31 |
admad |
the validation stuff is even available as a standalone lib https://github.com/cakephp/validation |
# |
Aug 26th 2019, 13:30 |
admad |
@davorminchorov as @ricksaccous pointed out the model validations actually validated the request data that is passed in, not the entity properties |
# |
Aug 26th 2019, 13:23 |
ricksaccous |
also patchEntity is the default way to apply validation before saving |
# |
Aug 26th 2019, 13:16 |
ricksaccous |
@davorminchorov all validation in cake is technically request validation by your definition i believe, the validation just really needs an array of keys, but yeah you are looking for model-less forms |
# |
Aug 26th 2019, 13:10 |
hmic |
https://book.cakephp.org/3.0/en/core-libraries/form.html |
# |
Aug 26th 2019, 13:09 |
davorminchorov |
oh cool, I'll check it out |
# |
Aug 26th 2019, 13:09 |
hmic |
tableless forms |
# |
Aug 26th 2019, 13:09 |
hmic |
actually theres docs on that usecase if i rmember correctly |
# |
Aug 26th 2019, 13:09 |
hmic |
however, I guess you can reuse the validation without a table involved. |
# |
Aug 26th 2019, 13:08 |
hmic |
that's still validation happening then. no need to do that similarly in another place again |
# |
Aug 26th 2019, 13:08 |
davorminchorov |
Form Request is just a name for the class they use as a convention, does not have to be a form specifically |
# |
Aug 26th 2019, 13:07 |
hmic |
i don't know about laravel, and i don't think it makes sense to couple that to forms specifically. though forms could be used to auto-generate this to some degree |
# |
Aug 26th 2019, 13:07 |
davorminchorov |
The scenario is: I need to validate the data before I pass it to the queue for saving |
# |
Aug 26th 2019, 13:06 |
hmic |
well, request introspection is easy to implement, just building your rules will be some effort |
# |
Aug 26th 2019, 13:06 |
davorminchorov |
Yeah, something similar to Laravel's Form Request classes and the rules you apply before the request hits the controller method |
# |
Aug 26th 2019, 13:06 |
hmic |
but you would not do that for add/edit only, probably. it's usefull for every request |
# |
Aug 26th 2019, 13:05 |
davorminchorov |
yeah |
# |
Aug 26th 2019, 13:05 |
davorminchorov |
which can be controlled separately |
# |
Aug 26th 2019, 13:05 |
hmic |
so you define valid requests upfront, maybe per action. cool thing! |
# |
Aug 26th 2019, 13:05 |
davorminchorov |
validation that happens before the save / update occurs |
# |
Aug 26th 2019, 13:05 |
hmic |
nice idea. like an application level firewall |
# |
Aug 26th 2019, 13:04 |
admad |
what do you mean by request validation? |
# |
Aug 26th 2019, 13:01 |
davorminchorov |
Hi, is there request validation in CakePHP 3.8? I can only see model validation in the docs |