-
Notifications
You must be signed in to change notification settings - Fork 45
Required decorator ignored on properties on child objects #53
Comments
What's the motivation behind using a class without a ConvectorModel? ConvectorModel is the one providing all this functionality, the decorators are just flags for it. |
The motivation is, i might be passing in a convector model that has child properties - i don't want these child props to be convector models as makes no sense for them to have a type or id (since they are stored inline with the parent and never accessed anywhere other than via the parent object). Also, i want to pass in payloads that might not be convector models (into the controller), and from there i might do multiple complex create/update delete of various other convector models - ie not always simple crud - sure i can use convector model but i wont ever store that model so having an id/type seems a bit pointless on it. Sort of like transactions in composer. For example
|
You can still use ConvectorModels for those cases. When you declare an inner property to be As I mentioned, the core logic for validations is inside the ConvectorModel class, if you don't use it, unexpected things might happen. |
Great i will try that on the inner properties. Regarding the 'simple object' as a controller method param - can i possibly do something like this
|
The problem
When creating a convector model which has properties which are simple classes, properties decorated with @require() on this child class are ignored.
Details
Having a property on a convector model that points to another class, then on that child class i have a required property - the save does not fail if i do not pass this value in for this property.
See This issue for code setup, just add a Required() attribute to one of the properties on the child class.
The text was updated successfully, but these errors were encountered: