markocupic / gallery-creator-bundle

Manage and display photo galleries. Plugin for Contao CMS.
GNU General Public License v3.0
7 stars 3 forks source link

Error: Creating a new Album #5

Closed surtic86 closed 5 years ago

surtic86 commented 6 years ago

Hello there,

I can't create new Albums since i Upgraded Contao and Gallery Creator. It should not set any Thumb on Album creation because you can't choose any at this Point.

Thanks for your Help.

An exception occurred while executing 'UPDATE tl_gallery_creator_albums SETthumb=NULL WHEREid='161'': SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'thumb' cannot be null

Versions:

markocupic commented 5 years ago

Sorry! But I can't reconstruct this error. Is there anybody out there with the same issue?

surtic86 commented 5 years ago

DePeder23 had the same Problem and looks like it was also there in Contact with you. https://community.contao.org/de/showthread.php?22634-gallery_creator/page21&styleid=9

The thing is that wen we Create a new Album there can't be already a Thumb so the Column should allow to be Null.

I have changed this Manually on the DB. Can it be that there was a DB Migration Issue? Should the Column thumb allow Null or not?

markocupic commented 5 years ago

https://github.com/markocupic/gallery-creator-bundle/blob/dc8c2ac83044f16c5b89c178747c2f6fb28adb45/src/Resources/contao/dca/tl_gallery_creator_albums.php#L218-L224

Ich verstehe nicht, wieso es zum Fehler kommt.

'sql' => "int(10) unsigned NOT NULL default '0'",

Der Default Wert ist doch '0'.

Liege ich irgendwie falsch?

surtic86 commented 5 years ago

Leider weiss ich nicht mehr wie die Definition bei mir auf der DB war da ich es nun von hand angepasst habe, dass NULL erlaubt ist.

Eventuell gibt es ja verschiedene MySQL Einstellungen wo 0 === NULL ist und somit dein Default Wert nicht erlaubt wird.

Aber so oder so macht es für mich irgend wie keinen Sin, dass du einen Default Wert 0 erlaubst der keine Verbindung hat aber NULL nicht.

markocupic commented 5 years ago

Leider weiss ich nicht mehr wie die Definition bei mir auf der DB war da ich es nun von hand angepasst habe, dass NULL erlaubt ist.

Eventuell gibt es ja verschiedene MySQL Einstellungen wo 0 === NULL ist und somit dein Default Wert nicht erlaubt wird.

Aber so oder so macht es für mich irgend wie keinen Sin, dass du einen Default Wert 0 erlaubst der keine Verbindung hat aber NULL nicht.

Aber das ist eigentlich der selbe Fall wie in der Callendar Erweiterung des Codes. Guck mal hier:

https://github.com/contao/contao/blob/e79f4cb153e09f34c678e500b9031990b8bd81c5/calendar-bundle/src/Resources/contao/dca/tl_calendar.php#L161

Oder nicht?

darthmax78 commented 5 years ago

Hy, I have the very same problem: After installing gallery-creator-bundle 1.2.2 on a fresh and clean contao 4.7.6 installation, I get this "An exception occurred while executing 'UPDATE tl_gallery_creator_albums SET thumb=NULL WHERE id='2'': SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'thumb' cannot be null" error. I also can reproduce this on a my longer running main site under contao 4.7.5.

Any ideas? Is this a bug? Is there any work around?

markocupic commented 5 years ago

Hi darthmax78 Would you post the error log?

darthmax78 commented 5 years ago

Thank you for the quick response!

from var/logs:

[2019-06-30` 15:15:10] 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://www.opti-net.at/contao?act=edit&do=gallery_creator&id=1&mode=2&pid=0&ref=jZrlua1Z&rt=wH3nPkTzBmGqQoAyMIYG7aVoMzwEQSlJG2pR8ZDZiqs","method":"POST"} []
[2019-06-30 15:15:10] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\NotNullConstraintViolationException: "An exception occurred while executing 'UPDATE tl_gallery_creator_albums SET `thumb`=NULL WHERE `id`='1'':  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'thumb' cannot be null" at /var/Webserver/Produktiv/Webspace/www.opti-net.at/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 123 {"exception":"[object] (Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException(code: 0): An exception occurred while executing 'UPDATE tl_gallery_creator_albums SET `thumb`=NULL WHERE `id`='1'':\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'thumb' cannot be null at /var/Webserver/Produktiv/Webspace/www.opti-net.at/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:123, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'thumb' cannot be null at /var/Webserver/Produktiv/Webspace/www.opti-net.at/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:109, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'thumb' cannot be null at /var/Webserver/Produktiv/Webspace/www.opti-net.at/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:107)"} []
markocupic commented 5 years ago

Could you describe exactly when teh error occurs? Backend/Frontend?

darthmax78 commented 5 years ago

Sorry if I was a bit unprecise:

First I install the gallery-creatore-bundle into the site via composer require on the bash. Then I update the database via install tool and afterwards clean & warmup the cache of the site. Final I login the backend and tried to create the first gallery. But when I try to change the sort order of the pictures or save the new gallery, there came the error. I've tried it with a brand new clean site under 4.7.6 (also total the same timeline) and it crashes during creating the gallery in the same way.

markocupic commented 5 years ago

Could you activate the debug mode in the contao manager and send me (m.cupic@gmx.ch) the credentials for:

darthmax78 commented 5 years ago

Of course - thank you very much for the quick and uncomplicated support!

markocupic commented 5 years ago

Fixed in 1bd06d9e083320bf1a07387e3938f43d6fbd8b27

darthmax78 commented 5 years ago

Perfect!!! Thanks for your outstandig quick response!!