Model Observers
The use of model observers has been used in several places of the app to reduce error for missing mandatory tasks that need to be invoked upon creation/modification/deletion of a model.
It is crucial to know where these are used and what their purposes are, as it is not clear when an observer is being invoked due to it working off of model events (no reference to the observer can be found within the model class itself).
Below are the observers for the models along with what their purposes are.
Collection
Event | Action |
---|---|
| Update the order for all other collections of the same type. |
| Update the order for all other collections of the same type. |
| Touch the related services (to synchronise with the search index). |
| Delete the child |
| Update the order for all other collections of the same type. |
CollectionTaxonomy
Event | Action |
---|---|
| Touch the related services (to synchronise with the search index). |
| Touch the related services (to synchronise with the search index). |
File
Event | Action |
---|---|
| Remove the physical file from disk. |
Location
Event | Action |
---|---|
| Touch the related services (to synchronise with the search index). |
| Delete the child |
| Delete the child |
| Touch the related services (to synchronise with the search index). |
Organisation
Event | Action |
---|---|
| Make all |
| Touch the related services (to synchronise with the search index). |
| Delete the child |
| Delete the child |
| Delete the child |
Referral
Event | Action |
---|---|
| Create a unique reference for the referral. |
| Delete the child |
Report
Event | Action |
---|---|
| Delete the associated |
ServiceLocation
Event | Action |
---|---|
| Touch the related services (to synchronise with the search index). |
| Delete the child |
| Delete the child |
| Delete the child |
| Touch the related services (to synchronise with the search index). |
Service
Event | Action |
---|---|
| Make all |
| Delete the child |
| Delete the child |
| Delete the child |
| Delete the child |
| Delete the child |
| Delete the child |
| Delete the child |
| Delete the child |
ServiceTaxonomy
Event | Action |
---|---|
| Touch the related services (to synchronise with the search index). |
| Touch the related services (to synchronise with the search index). |
Taxonomy
Event | Action |
---|---|
| Update the order for all other taxonomies with the same parent. |
| Update the order for all other taxonomies with the same parent. |
| Touch the related services (to synchronise with the search index). |
| Delete the child |
| Delete the child |
| Delete the child |
| Update the order for all other taxonomies with the same parent. |
UpdateRequest
Event | Action |
---|---|
| Send a notification to the submitter, confirming their submission. |
| Send a notification to the Global Admins, notifying them of the new update request. |
| Remove same fields for other pending update requests. |
| Delete pending update requests with an empty |