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

Fetch/Join Options

Discussion in 'XenForo Development Discussions' started by NixFifty, Aug 1, 2014.

  1. NixFifty

    NixFifty Well-Known Member

    Just a question regarding fetch/join options.

    At the top of XenForo_Model_Thread there is this:

    const FETCH_USER 0x01;
    FETCH_FORUM 0x02;
    FETCH_AVATAR 0x08;
    From my understanding, these constants are used to identify what other information should be pulled with the thread information. I was wondering if someone could provide a bit more insight as to how this all works as I'm a little confused. Like for example, FETCH_USER = 0x01. Is there any significance to that value or is it random?
  2. Aayush

    Aayush Well-Known Member

    if (!empty($fetchOptions['join']))
                if ($fetchOptions['join'] & self::FETCH_CATEGORY)
                    $selectFields .= ',
                        category.*, category.last_update AS category_last_update, resource.last_update';
                    $joinTables .= '
                        LEFT JOIN xf_resource_category AS category ON
                            (category.resource_category_id = resource.resource_category_id)';
    Some CMD+Click did the trick to find the above code.

    I think those are just random HEX. Instead of putting 1, 2, 4, 8 they have converted the decimals into their hex form.
    Most probably they have used it for performance reasons(I might be wrong here), since it's easier for computers to go from HEX to Binary than Decimal to Binary.

    PS: I just read on stackoverflow
    NixFifty likes this.
  3. NixFifty

    NixFifty Well-Known Member

    Makes sense. Thank you.

Share This Page