Accessing a base_module_record from its base_module_model ... ?
Not sure if that makes any sense so let me try to explain.
I've written my own class that extends base_module_model and base_module_record of course - and I want to add a default on_before_delete callback to all the objects of such class.
Now the real question is, how can i access the properties and methods of the base_module_record from the base_module_model itself?
Imagine that i have a record-level method for retrieving the image upload path, and that i want to delete all files inside the on_before_delete hook. How can I pass the $values['id'] to the record-level object and get the upload path back? Do i need to instantiate it ?
something like
$tmp = new MY_OWN_base_module_record_OBJECT()
?
$this
refers to the model, not the record object inside the on_before_delete hook...
Comments
$record = $this->my_model->find_by_key($values['id'];
The MY_Model delete method will accept either an array for the where condition or a Data_record class object. The delete method on the Data_record object actually just passes itself ($this) to the MY_Model delete method.