Edit Attribute
Closed this issue ยท 11 comments
Contao 4.13.23
Isotope 2.8.12
When I want to edit the one attribute, I get the following error message:
request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause'" at /www/htdocs/customer/host/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 67 {"exception":"[object] (Doctrine\\DBAL\\Exception\\InvalidFieldNameException(code: 1054): An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause' at /www/htdocs/customer/host/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:67)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1054): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause' at /www/htdocs/customer/host/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause' at /www/htdocs/customer/host/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:70)"} []
request.INFO: Matched route "contao_backend". {"route":"contao_backend","route_parameters":{"_route":"contao_backend","_scope":"backend","_token_check":true,"_controller":"Contao\\CoreBundle\\Controller\\BackendController::mainAction"},"request_uri":"https:/hostcontao?act=edit&do=iso_setup&id=1&mod=attributes&ref=8DGpAgCl&rt=c1e506.5S4YWJvQToiVCkkNoBiWlh-_Zmle5sR45jOW4U821lA.qXZIb_WhfMHKaxFAykCm0EvMNCAPiqAUrFbDjCVAmWKuVHNr3uk8--FYOg&table=tl_iso_attribute","method":"GET"} []
When I try to display it in debug mode, I don't even get that far, because already when I only call the attributes page the following error message comes up:
Uncaught PHP Exception ErrorException: "Warning: Undefined array key "current"" at /www/htdocs/customer/host/vendor/contao/core-bundle/src/EventListener/StoreRefererListener.php line 79
{
"exception": {}
}
Do you have the quickproducts extension installed?
Sorry, that was the wrong direction. Got the same error on a Cyon hosting, Contao 4.9.41, Isotope 2.8.12, on PHP versions 7.4, 8.1 and 8.2.
Stack trace:
PDOException:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause'
at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:141
at PDO->query('SELECT * FROM tl_iso_attribute_option WHERE tstamp>0 AND Array AND language=\'\' ORDER BY sorting', null)
(vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:141)
at Doctrine\DBAL\Driver\PDOConnection->doQuery('SELECT * FROM tl_iso_attribute_option WHERE tstamp>0 AND Array AND language=\'\' ORDER BY sorting', null)
(vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php:24)
at Doctrine\DBAL\Driver\PDOConnection->query('SELECT * FROM tl_iso_attribute_option WHERE tstamp>0 AND Array AND language=\'\' ORDER BY sorting')
(vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1309)
at Doctrine\DBAL\Connection->executeQuery('SELECT * FROM tl_iso_attribute_option WHERE tstamp>0 AND Array AND language=\'\' ORDER BY sorting')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php:274)
at Contao\Database\Statement->query()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php:248)
at Contao\Database\Statement->execute()
(vendor/terminal42/dcawizard/widgets/DcaWizard.php:389)
at DcaWizard->getRecords()
(vendor/terminal42/dcawizard/widgets/DcaWizard.php:197)
at DcaWizard->generate()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Widget.php:659)
at Contao\Widget->generateWithError(true)
(vendor/contao/core-bundle/src/Resources/contao/templates/backend/be_widget.html5:3)
at include('/home//xxxxxxxx/contao/vendor/contao/core-bundle/src/Resources/contao/templates/backend/be_widget.html5')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:100)
at Contao\Widget->inherit()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Widget.php:606)
at Contao\Widget->parse()
(vendor/contao/core-bundle/src/Resources/contao/classes/DataContainer.php:680)
at Contao\DataContainer->row('{attribute_legend},name,field_name,type,legend,variant_option,customer_defined;{description_legend:hide},description;{options_legend},optionsSource,[optionsSource],optionsTable,[EOF],includeBlankOption;{config_legend},mandatory;{search_filters_legend},fe_filter,fe_sorting,be_filter;{template_legend},customTpl')
(vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:1983)
at Contao\DC_Table->edit()
(vendor/isotope/isotope-core/system/modules/isotope/library/Isotope/BackendModule/BackendOverview.php:245)
at Isotope\BackendModule\BackendOverview->getModule('attributes')
(vendor/isotope/isotope-core/system/modules/isotope/library/Isotope/BackendModule/BackendOverview.php:84)
at Isotope\BackendModule\BackendOverview->generate()
(vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:432)
at Contao\Backend->getBackendModule('iso_setup', null)
(vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:169)
at Contao\BackendMain->run()
(vendor/contao/core-bundle/src/Controller/BackendController.php:48)
at Contao\CoreBundle\Controller\BackendController->mainAction()
(vendor/symfony/http-kernel/HttpKernel.php:169)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:81)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:201)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/index.php:31)
at require('/home/xxxxxxxx/contao/web/index.php')
(web/app.php:4)
The problem is in terminal42/contao-dcawizard
, see terminal42/contao-dcawizard#34
Is there a temporary way to fix this quickly?
If you don't plan to run any updates until this is fixed, then you can just manually edit the file in vendor/
directory:
If you don't plan to run any updates until this is fixed, then you can just manually edit the file in
vendor/
directory:
I tried using your fix. It did help get around the fatal errors but is causing other weird problems. For example, we have a site with multiple select menus. When we go to Store configuration > Attributes and edit a select menu every option in the database shows as an option instead of just the correct ones.
I ended up reverting back to the original version and commented out one line to get around the fatal errors and this way at least the selects only show their correct options instead of everything in the database.
public function getForeignTableCondition()
{
$langColumn = $this->langColumn ?: 'language';
$condition = parent::getForeignTableCondition();
//$condition .= " AND {$langColumn}=''";
return $condition;
}
Works fine in my case, I just checked again. I have one select
attribute with "Options manager", and one radio
attribute with "Product" as options sources. Everything shows correctly, my installation is even multi-domain/multi-lingual. I would start by checking, what the resulting query is being run when you see your weird results. Either in the profiler or by debugging.
The problem is with more than one select menu. Try making more than one then you'll see what I'm talking about. One select shows every option, even if it belongs to another select menu.
What are you using for options source in those attributes? And again, without looking at the resulting query we can only guess. Or without hearing from the developers, because it's not clear how was it supposed to work anyway :)
Yea, I am just reporting what is going on here on our end. On this site there are about ten select menus and they are using the Options Manager. I used that fixed you put up and things went great until it came time to edit one of the options and we noticed it was showing way too many to be correct.
This has been fixed in dcawizard v2.6.3
This has been fixed in dcawizard v2.6.3
Thank you, I tested this out on the dev site we were having issues with and this works perfectly.