Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Add sorting key to metadata #1184

Merged
merged 2 commits into from
May 23, 2024

Conversation

csidirop
Copy link
Contributor

@csidirop csidirop commented Mar 5, 2024

See #1183

I added the missing entries in MetadataDefaults.php and added a call in addMetadataAction() so that it is saved in the metadata object.
But it is not stored in the DB, where the value for the sorting key is still 0.

Any idea?

Signed-off-by: Christos Sidiropoulos <[email protected]>
@sebastian-meyer sebastian-meyer self-requested a review March 6, 2024 08:28
@sebastian-meyer sebastian-meyer added the 🐛 bug A non-security related bug. label Mar 6, 2024
@sebastian-meyer sebastian-meyer linked an issue Mar 6, 2024 that may be closed by this pull request
@sebastian-meyer sebastian-meyer changed the title Add sorting key to metadata [BUGFIX] Add sorting key to metadata Mar 6, 2024
@sebastian-meyer
Copy link
Member

sebastian-meyer commented Mar 7, 2024

According to documentation sorting should be handled by the DataHandler without any need for manually setting values in the database. It should be sufficient to set sortby in the TCA (which we did) and TYPO3 should do the rest. I have no idea why it doesn't work...

@csidirop
Copy link
Contributor Author

Okay, thanks for checking the documentation. Thats really weird than

@beatrycze-volk
Copy link
Collaborator

According to documentation sorting should be handled by the DataHandler without any need for manually setting values in the database. It should be sufficient to set sortby in the TCA (which we did) and TYPO3 should do the rest. I have no idea why it doesn't work...

Currently DataHandler is not used to insert metadata. I was writing about it here #1147 (comment) :

Extbase directly writes to the database, and thus bypasses DataHandler. DataHandler is actually the one which is responsible for the localization of records.

@sebastian-meyer
Copy link
Member

sebastian-meyer commented Mar 13, 2024

Extbase directly writes to the database, and thus bypasses DataHandler. DataHandler is actually the one which is responsible for the localization of records.

But that's by choice, not by design, isn't it? I don't see a reason not to revert to using the DataHandler with Extbase (at least in backend context). The DataHandler is still available in TYPO3 v12. The old implementation (Extbase + DataHandler) can be seen here: https://github.com/kitodo/kitodo-presentation/blob/1ff03fc4c3ab4dfdc0102d5d98837f1e72f57103/Classes/Controller/NewTenantController.php

@sebastian-meyer
Copy link
Member

Oh, I just saw that you already suggested restoring the old method using the DataHandler in #1147... Sorry, I missed that!

But yes, I think that's the way we should proceed!

@beatrycze-volk
Copy link
Collaborator

But yes, I think that's the way we should proceed!

Ok, then I will revert it.

@beatrycze-volk
Copy link
Collaborator

@csidirop As I'm still working on DataHandler usage and can't give the prediction when it will work (basic save works but no localization) ,I have found workaround for sorting problem: beatrycze-volk@6e02b6e

It is necessary to add to tx_dlf_metadata.php:

        'sorting' => [
            'config' => [
                'type' => 'passthrough',
            ],
        ],

@sebastian-meyer Are you ok with this solution?

@sebastian-meyer
Copy link
Member

It is necessary to add to tx_dlf_metadata.php:

        'sorting' => [
            'config' => [
                'type' => 'passthrough',
            ],
        ],

@sebastian-meyer Are you ok with this solution?

Yes, that's fine! Thank you!

@sebastian-meyer sebastian-meyer marked this pull request as ready for review May 23, 2024 11:29
@sebastian-meyer
Copy link
Member

Merging this as a temporary workaround (see #1209).

@sebastian-meyer sebastian-meyer merged commit 2c961bb into kitodo:master May 23, 2024
6 checks passed
@csidirop csidirop deleted the fix/metadatasorting branch May 28, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug A non-security related bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Metadata sorting value is 0 for every entry
3 participants