What does getTablesDataFromArray in the DataWriter do?

Robust

Well-known member
What does getTablesDataFromArray do? I don't really understand its purpose. The tables data is already given if you do getForumById, for example, so why do this?

e.g. from XenForo_DataWriter_Forum:
Code:
    protected function _getExistingData($data)
    {
        if (!$nodeId = $this->_getExistingPrimaryKey($data))
        {
            return false;
        }

        $forum = $this->getModelFromCache('XenForo_Model_Forum')->getForumById($nodeId);
        if (!$forum)
        {
            return false;
        }

        return $this->getTablesDataFromArray($forum);
    }
 
A single DataWriter can support writing to, and returning data from, more than one table e.g. the user DW supports xf_user, xf_user_profile etc. and the forum DW supports xf_forum and xf_node.

That function arranges the data returned from the query (which may include data from more than one table via joins) into an array grouped by the table it came from.
 
Back
Top Bottom