1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What does getTablesDataFromArray in the DataWriter do?

Discussion in 'XenForo Development Discussions' started by Robust, Dec 20, 2015.

  1. Robust

    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:
        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);
  2. Chris D

    Chris D XenForo Developer Staff Member

    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.
    Robust likes this.

Share This Page