lochmueller / focuspoint

🌅 Smartest TYPO3 Crop Tool ever 🌅
http://typo3.org/extensions/repository/view/focuspoint
22 stars 23 forks source link

FileReference is always 0 (zero) and not NULL #40

Closed benjamingries closed 6 years ago

benjamingries commented 7 years ago

Hi, I tried to install the extension focuspoint and got am error. My problem is: The merged properties in file_reference is always 0 (zero). Even when in metadata the values are correctly set.

I discovered that the reason is the \TYPO3\CMS\Core\Resource\FileReference::restoreNonNullValuesCallback method, which checks the original values and if the original value was not null it will revert the merged value to 0 (zero), which is not null.

So I am a little bit curious, because for me it looks like, that the whole extension is currently not working (using latest TYPO3 7.6). Do you have any hint for me, to get the focus_point_x and _y correctly merged?

Thanks in advance!

a2er commented 7 years ago

I had the same issue on TYPO3 8.7.1.

My (quick&dirty) solution was:

  1. Remove:
    • Classes/Domain/Model/FileReference.php
    • Configuration/TCA/Overrides/sys_file_reference.php
  2. Reinstall plugin
  3. Clean up database (Database analyzer)

It seems that i had this issue allready on an other T3 instance (7.6.18) there i used {file.originalFile.properties.focus_point_y} to access the property.

yeldiRium commented 6 years ago

My Suggestion for an official Fix: In the File Classes/Domain/Model/FileReference.php the Annotations for the focuspoint fields should be * @db int(11) null instead of * @db

This allows the focus point values on FileReferences to be null, which allows the values in the MetaData to be loaded. It, of course, does not help with existing FileReference data points, which already have their zeroes set. But it allows you to set all zeroes to null in one go, once the db schema is up to date.

I'm currently patching this extension to do that.