$row->weight = empty($weight) ? 0 : ++$weight;