Open rammrain opened 10 years ago
Good idea. No need to have template generation in this lib. This can be done in module. However I would implement some sort of formatter pattern instead of hardcoding object to string on ErrorService. One formatter can be SimpleFormatter in key: value format where new keys are separated with newline. Also there can be ObjectFormatter. Then when error is triggered then the error object is sent as is. This would be useful in some cases.
Now the error reporting module can implement template based formatter and inject it.
I think the SimpleFormatter in key : value format would be good, maybe we even should put this in the stdlib, since this lib has already dependency to stdlib. But also the raw serialization of an object would be useful, if for example we would want to send the errors for logging to a service. So I think we should make this configurable.
I wouldn't put this on stdlib, because it is very hard to make this kind of raw serialization abstract. Consider an example, when object contains other objects etc. And stdlib should contain abstract behavior.
This can remove the concrete dependency to zend-view. Any opinions on what to use then to make the mail somewhat human readable, instead of just sending a serialized object?