<?php

declare(strict_types=1);

namespace KupShop\AdminBundle\AdminListMassEdit;

class ParameterValuesListMassEdit extends BaseListMassEdit
{
    protected function massSaveInt($field, $activeIds, $values)
    {
        parent::massSaveInt($field, $activeIds, $values);

        if ($field === 'position') {
            sqlQuery('SELECT @i := -1; UPDATE parameters_list SET position = (select @i := @i + 1) WHERE 1 ORDER BY position, value');
        }
    }
}
