-
Notifications
You must be signed in to change notification settings - Fork 27
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
Creating entities #24
Comments
Hi @waghanza This bundle makes the hydrator's fields based on doctrine fields, so both of them are same. |
Hi, @paknahad Where could you set validExistance to false ? Regards, |
in this line $this->validateFields($this->objectManager->getClassMetadata(Book::class), $request, false); |
but in this case the field type could not determined in
|
yeah. on changing the name of a field( or adding a field to hydrator which doesn't exist in the entity), you can't expect to validate automatically. so I wrote in my first comment, you must validate this fields by a custom validator. |
but how we can add our custom validator ? |
In generated AbstractHydrator at the "validateRequest" method, after or instead of this line actually, you are able to change any line of generated codes based on your needs |
@paknahad I see, but how about having generators that could be customized ? I mean instead creating something like a custom recipe For example, we can use a optional param to What do you think ? |
Sounds nice. but I'm so busy currently. if you could implement this feature, I would be glad to merge your PR. |
Hi @paknahad,
I can see that
ValidatorTrait
validate fields usingdoctrine
fields name, is not accurate to usegetAttributeHydrator
return fieldsjsonapi-bundle/src/Hydrator/ValidatorTrait.php
Line 85 in d09115c
I mean, when I create object (
POST
on/book
in my https://github.com/waghanza/book-manager), fields (indata
on my json) are validated according to what doctrine know, not what hydratator knowRegards,
The text was updated successfully, but these errors were encountered: