-
Notifications
You must be signed in to change notification settings - Fork 23
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
@FormArrayAnnotation() with inheritance #99
Comments
Hi. If you are interested in an example with huge amount of fields you can create one as PR to this repo and I will try to help you organising your approach |
Hi, Here https://github.com/Guillaume-Cornet/reactiveForm-inheritance-poc This is a repo with an example of the architecture from my project. You'll find a 'model' folder with the structure :
Each on this event has a custom dynamic form Thanks, Guillaume. |
Please supply all required folder for running
I do not have time to fight with running the repo |
|
first question
Can you place each event in separate array? |
Hi, Sorry, i have generate the project with IntelliJ and i did'nt get warning for the name.
This structure come from an old apps and represent a life cycle of patient surgery.
In the complete model, all this event has a date field and will be sort by date. |
I have some ideas about implementation. |
@vasilich6107 I would like to have inheritance in my form models, too. Two ways I currently cast to dynamic are:
And making the return type of this function dynamic when it should be
I use |
Hi @BenjiFarquhar I created class A and subclassed all items from it
then I was able to easily manipulate them. Could you provide the real world example cause I do not understand the issue. |
@vasilich6107 I can't really reconcile how I would use a This is what I want:
I want |
Sorry |
@vasilich6107 It won't compile, as To really simplify what I want, and get to the main point: I just want the generated |
The generated model is also I can rename I don't know if this is possible, I'm just asking. |
The generator was designed to generate form representation from model. I never tested or thought that it makes sense to extend the model from another generated DetailsForm. this is why I’m asking about the task you want to solve. Sometimes the solution is reasonable. Sometimes not. I can’t tell which case is yours cause I do not know what you want to achieve |
It is just common to use polymorphism in programming. I'm using it to implement the abstract factory pattern. I have a base factory, a RecipeFactory, a RestaurantFactory, etc, and they each have a variation of a DetailsForm - either a BaseDetailsForm, a RecipeDetailsForm, or a RestaurantDetailsForm. I've worked on two apps that have implemented the same category of form for multiple different entities, which all need to vary independently, and we have used the abstract factory pattern both times. It is primarily useful when the user can press a button and the other entity form gets displayed. I find code generators rarely support inheritance; it's usually a limitation. I have the same experience with Freezed; I have worked around it with |
I check the thread on |
@vasilich6107 rrousselGit/freezed#907 It could also support inheritance on non-freezed classes until freezed supports it. |
Hi,
I have an equivalent of this case in my model.
But i can't make it working with the forms and i don't find in documentation how to use @FormArrayAnnotation with inheritance.
Is this use case possible with reactive_forms ?
ps : apart from this problem, this lib is awesome ! In this project i have a big forms with ~250 different fields to update with many validations and i looking for the more elegant way to do that.
Thanks, Guillaume.
The text was updated successfully, but these errors were encountered: