247 | | The {{{ondelete}}} callbacks are meant to perform extra post-processing of the deleted record (e.g. to update dependent records). The callback functions receive the respective '''record''' as first and only parameter, while their return value will be ignored. |
248 | | |
249 | | Note: |
250 | | At the time when the callback is invoked, the record is already deleted from the database. |
| 247 | The {{{ondelete_cascade}}} callback is to perform cascade actions before deleting a record (e.g. to update or remove dependend records, or to release constraints that cannot be introspected). The hook will receive the ''record'' as its only parameter (note that it will only contain the record ID), its return value will be ignored. |
| 248 | |
| 249 | '''Note:''' the ''record'' will only contain the record ID but no details |
| 250 | |
| 251 | ==== On-Delete Callback ==== |
| 252 | |
| 253 | You can also define callbacks to be invoked ''after'' a record has been deleted: |
| 254 | |
| 255 | {{{ |
| 256 | s3db.configure(tablename, ondelete=callback) |
| 257 | }}} |
| 258 | |
| 259 | where: |
| 260 | |
| 261 | - '''table''' is the respective DB table |
| 262 | - '''callable''' is the callback setting, see [#Callbacks Callbacks] |
| 263 | |
| 264 | The {{{ondelete}}} callbacks are meant to perform extra post-processing of the deleted record (e.g. updates to counters or other aggregates). The callback function will receive the respective ''record'' as its only parameter, while its return value will be ignored. |
| 265 | |
| 266 | '''Note:''' at the time when the callback is invoked, the record is already deleted from the database. |
| 267 | '''Note:''' the ''record'' will only contain the record ID but no details |