Question: Different Relation Model based on Model attribute - how? #783
Labels
enhancement
A feature that exists, works as intended but needs to be improved
feature request
A feature that does not yet exist but will be a good addition to the library
Describe the feature as you'd like to see it
I have a couple of models which contain a UUID/ID (not foreign key) and a flag which denotes which Destination Model the UUID/ID is attached to.
In other ORM's I have dropped in some logic which checks the flag and then uses the correct model.
Currently this logic (in masonite orm) results in a recursion error as using
self
in the decorated method to check the attribute is not possible.I'm not sure if this is a bug or a feature request or is this something that can be achieved via a lambda/function
In this example the recursion error is due to the
self.vehicle_type
in the method which calls the Model (self) to get its relations and attributes which then descends into the decoratedvehicle
method, which then gets the Model (self) relations ........is there another way to achive this kind of `flagged' logic?
I'm happy to try out new logic but this seems to be the most straight forward to achieve the outcome
Using a pivot table is not really suitable for this scenario.
What do we currently have to do now?
Don't have any way to do this currently
Additional context
Add any other context or screenshots about the feature request here.
No
The text was updated successfully, but these errors were encountered: