All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Can't save variables

Caroline C. Blaker 11 Jun 2019 18:43 problem, active

I have 2 grid variables. One has an asset column.

The one with the asset column is a live variable, the other grid is a test without an asset column.

Recently we began noticing that the live variable wasn't saving. This came after noticing that the variable had dropped all Asset data, spontaneously. The error on the page would be yellow and say Variable information saved, except for [the grid with the asset].

To troubleshoot this, I created a grid with no asset. Saving the page with both grids yields the following stack trace. (I'm not sure why it would try to save null. I've made sure every little thing in the variable data had a value to try to eliminate this.)

Exception Caught
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'variable_data' cannot be null:
UPDATE 'exp_global_variables' SET 'variable_data' = NULL WHERE 'variable_id' = 11
ee/legacy/database/drivers/mysqli/mysqli_connection.php:117

Stack Trace: Please include when reporting this error
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('UPDATE 'exp_glo...')
#1 ee/legacy/database/DB_driver.php(270): CI_DB_mysqli_driver->_execute('UPDATE 'exp_glo...')
#2 ee/legacy/database/DB_driver.php(180): CI_DB_driver->simple_query('UPDATE 'exp_glo...')
#3 ee/legacy/database/DB_active_rec.php(1477): CI_DB_driver->query('UPDATE 'exp_glo...')
#4 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(129): CI_DB_active_record->update('global_variable...')
#5 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(99): EllisLab\ExpressionEngine\Service\Model\Query\Update->actOnGateway(Object(EllisLab\ExpressionEngine\Service\Model\SyntheticGateway), Object(EllisLab\ExpressionEngine\Model\Template\GlobalVariable))
#6 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(48): EllisLab\ExpressionEngine\Service\Model\Query\Update->doWork(Object(EllisLab\ExpressionEngine\Model\Template\GlobalVariable))
#7 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(282): EllisLab\ExpressionEngine\Service\Model\Query\Update->run()
#8 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(248): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#9 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(71): EllisLab\ExpressionEngine\Service\Model\DataStore->updateQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#10 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(361): EllisLab\ExpressionEngine\Service\Model\Query\Builder->update()
#11 user/addons/low_variables/models/low_variables_variable_model.php(135): EllisLab\ExpressionEngine\Service\Model\Model->save()
#12 [internal function]: Low_variables_variable_model->{closure}(Object(EllisLab\ExpressionEngine\Model\Template\GlobalVariable))
#13 ee/EllisLab/ExpressionEngine/Library/Data/Collection.php(291): array_map(Object(Closure), Array)
#14 user/addons/low_variables/models/low_variables_variable_model.php(136): EllisLab\ExpressionEngine\Library\Data\Collection->each(Object(Closure))
#15 user/addons/low_variables/mcp.low_variables.php(403): Low_variables_variable_model->update(11, Array)
#16 [internal function]: Low_variables_mcp->save('1')
#17 ee/EllisLab/ExpressionEngine/Controller/Addons/Addons.php(1662): call_user_func_array(Array, Array)
#18 ee/EllisLab/ExpressionEngine/Controller/Addons/Addons.php(946): EllisLab\ExpressionEngine\Controller\Addons\Addons->getModuleSettings('low_variables', 'save', Array)
#19 [internal function]: EllisLab\ExpressionEngine\Controller\Addons\Addons->settings('low_variables', 'save', '1')
#20 ee/EllisLab/ExpressionEngine/Core/Core.php(241): call_user_func_array(Array, Array)
#21 ee/EllisLab/ExpressionEngine/Core/Core.php(110): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#22 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#23 docs/manage.php(153): require_once('...')
#23 docs/manage.php(153): require_once('...')

Replies

  1. Low 11 Jun 2019 18:47

    Can you try and run this query and see if that helps?

  2. Caroline C. Blaker 11 Jun 2019 19:09

    That did help! Thank you.

    However, the Asset Grid still isn't saving, no matter what I change in it, be it Asset file or text.

    Taking a peek into the table where this variable is stored, I see that there is Data there in the Asset field that isn't coming through to the control panel, mainly just a string.jpg or a string.png. I don't know how to debug why the whole table wouldn't save, however.

  3. Low 11 Jun 2019 19:15

    I'd ask EEHarbor about this. Here, LV just calls Grid, which calls Assets, which should save its data in the right place. LV doesn't do any of the actual saving of the Assets data itself.