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

Fixed _setAutoIncrementValue checking/update wrong key

Discussion in 'Resolved Bug Reports' started by Jon W, Dec 29, 2014.

  1. Jon W

    Jon W Well-Known Member

    In XenForo_DataWriter, the following line:
    PHP:
                        if ($fieldType['default'][0] == $tableName && !$this->get($field$table))
                        {
                            
    $this->_newData[$table][$field] = $insertId;
                        }
    should be:
    PHP:
                        if ($fieldType['default'][0] == $tableName && $fieldType['default'][1] == $field && !$this->get($fieldName$table))
                        {
                            
    $this->_newData[$table][$fieldName] = $insertId;
                        }
    I'm trying to extend a datawriter and add a table where two columns both have the default value that is the primary key of the main table, but it will only do it if I name the column the same as the main primary key. Not sure if this is as designed.
     
    Last edited: Dec 29, 2014
  2. Mike

    Mike XenForo Developer Staff Member

    I believe this is a safe change (and it's passed my tests) so I've changed it, though I wouldn't really recommend on relying on it as joining like that with a different field name isn't really the XF way and your code would be depending on 1.4.4+ (rather than just 1.4+, say).
     
  3. Jon W

    Jon W Well-Known Member

    Thanks. I've overidden the method in my code for now, but I will turn off the override for 1.4.4+ so my code will now be more future proof.
     

Share This Page