Ticket #1208 (closed defect: fixed)
ability to define record level handlers for custom fields
| Reported by: | ccunningham | Owned by: | romanb |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.1.0-ALPHA1 |
| Component: | Listeners | Version: | 1.0.0 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | no | |
| Status: | Pending Core Response | Has Patch: | no |
Description
It would be nice if you could put the equivalent of a preHydrate handler in your record class to add custom/calculated fields to your model. The current method requires a HydrateListener? which works, but requires you to either have one for each type of custom field you want, or just one that has to do some introspection and switches to handle different things. If you have a dozen models each of which may need their own set of custom fields, this becomes a real pain. If you could just throw it in the record class like:
public function preHydrate( $event ) {
if ( $this->due_date < ... ) {
$this->status = 'current';
} else {
$this->status = 'expired';
}
}
Change History
Note: See
TracTickets for help on using
tickets.