TheBigK
Well-known member
So far, I've been blindly following the DataWriter creation for my simpler addons; but have decided to figure out what's really happening behind the scenes. I see this explanation (comment)
The words "gets the actual existing data out of data that was passed in" confuse me.
1. Where is this $data coming from? What does it contain when being passed on to the function?
2. Why is it mandatory to define this function in any data writer?
Code:
/*** Gets the actual existing data out of data that was passed in. See parent for explanation.** @param mixed** @return array|false*/protected function _getExistingData($data)
{
if (!$id = $this->_getExistingPrimaryKey($data, 'note_id'))
{
return false;}
return array('scratchpad_note' => $this->getModelFromCache('Scratchpad_Model_Note')->getNoteById($id));}
The words "gets the actual existing data out of data that was passed in" confuse me.
1. Where is this $data coming from? What does it contain when being passed on to the function?
2. Why is it mandatory to define this function in any data writer?