Had a couple thoughts when integrating BaseORMService
1) Can you add dml style deletes to the TODO:s? Right now every call
to delete() executes two queries. One to get the entity and another
to delete it. Need a better way to do bulk deletes.
2) Regarding the hyrule integration, I'd prefer it if on validation
error coldBox would raise an exception rather than returning the array
of errors messages from hyrule.
My reasoning is that I am trying to workout the logic in handling the
return data from the BaseORMService.save function and how to catch
validation errors. Right now it appears to be:
var saveResult = ormService.save( entity = myEntity, validate =
true );
if (isBoolean(saveResult) && saveResult ) {
// set flash msg and next action
} else {
// set error message and show form
rc.errorDetail = saveResult;
}
If coldbox threw an exception I think the code to handle this would
read much better:
try {
ormService.save( entity = myEntity, validate = true );
} catch ( coldbox.validation.hyrule error ) {
rc.errorDetail = DeserializeJSON(error.extendedInfo);
}
The trick is for ColdBox to serialize the hyrule error data into JSON
and pass that string as the throw() extendedInfo attribute. The error
type can be whatever I generally like hierarchical error types so I
can catch coldbox.validation.hyrule with it with catch
( coldbox.validation.hyrule error ) or catch ( coldbox.validation
error ) or even catch ( coldbox error )
Just a couple ideas, thanks!
.brett