-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing the DomainObject to the validateRequest() method of the hydrator class #104
Comments
So I made a fork and made the changes needed to solve my current issue: master...signet-connectivity:pass-object-to-validator I guess its a backwards incompatible change. I could solve this without making these changes, but I would have to copy/paste some of the trait methods. I think in the end that it's hard to extend/reuse The traits are both an implementation and a contract. I think separating just that would make things easier to extend. |
Hi @Ilyes512 Sorry for not not replying so long. I'll carve out some free time for Yin this week so that I can look into the open tickets. |
No problem :) BTW, I am also no a 100% sure if this is the way to go. |
Can you please tell me why the Regarding the BC impact, I have a possible idea: we could add a new |
Yes. So what I have is an entity that has 2 attributes, Regarding your solution... I think that will work in my case. First check that the received The |
Thanks for the quick answers!
My idea is to run |
I added e55ee84. Can you please test it? |
Yes! I tested this out on my actual problem... and it works for my case :). Just one remark (cause now it wouldn't be backwards imcompatible). Maybe also pass the To merge my requests (internal work projects) I would need this to be released to a stable version first... I guess it won't take long before it's tagged :)? |
Huh, although I think it's really a bit too much of overengineering, I'm ok to add it (e.g.
I have to wait a little bit for another feedback (#103), but I can release the next version soon if everything goes well. |
I've just release 4.3.0 including the validation of the domain object. :) |
I am about to create my own hydrator base class so I can get my hands on the current DomainObject when validating. I was wondering if this made sense, and if so, if you would except a merge request for it?
So the change would mainly be made here: https://github.com/woohoolabs/yin/blob/master/src/JsonApi/Hydrator/UpdateHydratorTrait.php#L107-L108 I will pass the
$domainObject
-var to the$this->validateRequest($request);
call and update the abstract methods signatures. The same changes would also be made for thecreate
side/hydrator.The reason I would like to do this is to pass the current object that contains data that I would like to use when validating the incoming request.
Any thoughts?
The text was updated successfully, but these errors were encountered: