t3brightside / youtubevideo

TYPO3 CMS extension for easy to use YouTube content element with cover image and title.
https://t3brightside.com
Other
4 stars 5 forks source link

Inserting fails without startminute and startsecond #3

Closed rtoenjes closed 3 years ago

rtoenjes commented 5 years ago

When inserting a video via BE there are errors:

SQL error: 'Incorrect integer value: '' for column 'tx_youtubevideo_startminute' at row 1' 
SQL error: 'Incorrect integer value: '' for column 'tx_youtubevideo_startsecond' at row 1'

I have to add a startminute = 0 and a startsecond = 0 by hand to add a video.

The table seem to be ok with:

tx_youtubevideo_startminute int(11) [0]
tx_youtubevideo_startsecond int(11) [0]

Any advices?

moe2k commented 4 years ago

I have the same issue. TYPO3 v9, PHP 7.2, mariadb 10.2 Setting a default of 0 helps:

$GLOBALS['TCA']['tt_content']['columns']['youtubevideo_startminute']['config']['default'] = 0;
$GLOBALS['TCA']['tt_content']['columns']['youtubevideo_startsecond']['config']['default'] = 0;
t3brightside commented 4 years ago

Sry for the late reply. I guess this should do it? tx_youtubevideo_startminute int(11) DEFAULT '0', tx_youtubevideo_startsecond int(11) DEFAULT '0', Not possible to test right now...pushed it to the master thou.

moe2k commented 4 years ago

Unfortunately that didn't help in my case. TYPO3 9.5.16, PHP 7.3, Mariadb 10.2. Mysql still reports:

SQL error: 'Incorrect integer value: '' for column db.tt_content.tx_youtubevideo_startminute at row 1'

Looks like a database / TCA mismatch issue, the TCA default = 0 workaround helps though.

tgaertner commented 3 years ago

This happens because of MySQL strict mode, which is default since 5.7. It can be fixed by adding default (and to be super save eval) to the integer fields.

I created a PR for that: https://github.com/t3brightside/youtubevideo/pull/9

tgaertner commented 3 years ago

Could you tag the current master with 1.4.1 then this is fixed and comfortable installable.

t3brightside commented 3 years ago

I'll look over it sometime soon. Not really happiest with the solution where it shows zeros in the form by default. It should be just empty if it's not in use. Any ideas?

moe2k commented 3 years ago

Maybe you can work with NULL so by default the inputs are disabled and you have to check a box if you want to set a value:

default => null
eval => null

and in Database:

tx_youtubevideo_startminute int(11) DEFAULT NULL
tx_youtubevideo_startsecond int(11) DEFAULT NULL
t3brightside commented 3 years ago

@moe2k not a bad idea, but I think it's a bit too much UX wise as well. Anyhow I have created a new tag for now, I'll close the issue for now, maybe one day there will be better solution for this. Thanks everybody!

tgaertner commented 3 years ago

maybe eval => int without the default does the trick..? But have not checked jet.