heimrichhannot / contao-api-bundle

API to access (restricted) contao privacy module from 3rd-party applications
5 stars 12 forks source link

DB-Error in EntitiyResource::List() #13

Closed srhinow closed 2 years ago

srhinow commented 3 years ago

Da ein leeres Array an die ModelKlasse countBy() und findBy gegeben wird erstellt er ein leeres WHERE. [2021-07-01 15:13:32] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\SyntaxErrorException: "An exception occurred while executing 'SELECT COUNT(*) AS count FROM tl_calendar_events WHERE': SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" at /var/www/r/rms-contao/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 98 {"exception":"[object] (Doctrine\\DBAL\\Exception\\SyntaxErrorException(code: 0): An exception occurred while executing 'SELECT COUNT(*) AS count FROM tl_calendar_events WHERE':\n\nSQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at /var/www/r/rms-contao/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:98, Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at /var/www/r/rms-contao/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at /var/www/r/rms-contao/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:132)"} []

Wenn man vorher abfragt ob $columns leer ist und dann auf null setzt, dann funktionieren auch die DB-Abfragen: grafik

koertho commented 2 years ago

@srhinow Danke für die Meldung. Ich habe gerade ein Projekt, wo das Bundle genutzt wird (witzig, weil es auf dem Bar-Camp auch ein Thema war und ich nicht wirklich was dazu sagen konnte, außer dass es aktuell nicht aktiv entwickelt wird). Jedenfalls wird der Bug in der nächsten Version behoben.