# |
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 |
# |
Aug 26th 2019, 11:47 |
alexdd55976 |
one work day in the trash |
# |
Aug 26th 2019, 11:47 |
alexdd55976 |
last week i spend a whole day trying to authenticate against LDAP/AD ... today i got a message, that the auth is not available to users due to special rights |
# |
Aug 26th 2019, 11:01 |
martin |
I think webservice is easier? most of the orm already support it? just implement it in the webservice driver I think |
# |
Aug 26th 2019, 10:19 |
challgren |
Ok so heres a question for yall. QBO has a webservice XML and JSON, to access this webservice the “queries” are a modified variant of SQL. Would it be better to write a ORM Driver or Build off of https://github.com/UseMuffin/Webservice |
# |
Aug 26th 2019, 09:37 |
challgren |
And https://github.com/cakephp/cakephp/blob/master/src/Http/Session.php#L36 |
# |
Aug 26th 2019, 09:36 |
challgren |
https://github.com/cakephp/cakephp/blob/master/src/Http/ServerRequest.php#L323 |
# |
Aug 26th 2019, 09:28 |
awime |
Does anyone know where Cake opens and closes sessions. I seem to have some weird session locking issues |
# |
Aug 26th 2019, 09:28 |
awime |
hi |
# |
Aug 26th 2019, 08:36 |
conehead |
Or extend a custom Table |
# |
Aug 26th 2019, 08:36 |
conehead |
Why would you need it in core? I cannot see a general use case for this. Just create a trait and use it where needed |
# |
Aug 26th 2019, 08:13 |
marek.sebera |
could striping entity assoc properties be included in core? this is what i came up with instead https://gist.github.com/smarek/4eb45ff9abc64627dcf6d42301d3ebef |
# |
Aug 26th 2019, 07:31 |
conehead |
@ashish_onmobile I think GET is not affected by cors |
# |
Aug 26th 2019, 07:14 |
ashish_onmobile |
GET is working for port number :4200 but POST , PUT not working |
# |
Aug 26th 2019, 07:13 |
ashish_onmobile |
public function beforeFilter(Event $event) { parent::beforeFilter($event); $this->response= $this->response->cors($this->request) ->allowOrigin([‘*’]) ->allowMethods([‘GET’, ‘POST’,‘PUT’,‘OPTIONS’]) ->allowHeaders([‘X-CSRF-Token’]) ->allowCredentials() ->exposeHeaders([‘Link’]) ->maxAge(300) ->build(); |
# |
Aug 26th 2019, 07:13 |
ashish_onmobile |
I have added below code in AppController.php |