DAO should allow to remove stale data object settings via method call

Hi there,

I have a situation where a user saved a submission with data A, B and C stored in the submission_settings table. After changing a specific field and saving the submission data B and C is not valid anymore hence i need to remove this data from the table. I see no possible way in the implementation of DAO to do this without hacks but there is already a stale handling in setData() which could be reused. I moved this code part to a separate method called removeStaleDataObjectSettings and now I can use it like this

$submissionDao = Application::getSubmissionDAO();
$submissionDao->removeStaleDataObjectSettings('submission_settings',
    array('submission_id' => $submission->getId()), $staleSettingNames);

Would this be a change you are willing to include in the GitHub repo? Shall i prove a PR then?

So lonG

Hi @j1shin,

Can you describe your data use case in more detail? I don’t think I’ve run into this circumstance before and would like to make sure I understand the situation.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

the issue basically appears when [OJS] Submissions, ticked checks like submission requirements and privacy consent are not saved · Issue #4031 · pkp/pkp-lib · GitHub gets solved. If a user submits step 1 of the submission wizard then the submission preparation list entries are stored in the settings table (see PR of [OJS] Submissions, ticked checks like submission requirements and privacy consent are not saved · Issue #4031 · pkp/pkp-lib · GitHub). Now, when the admin changes the submission preparation list, lets say he / she removes an item then this item will not be removed from the settings table when the user submits step 1 again. Hope this helps to understand the issue.

So lonG

Hi @j1shin,

Yes, your proposal makes sense. Please open a PR linking back here and I’ll take a look.

Thanks,
Alec Smecher
Public Knowledge Project Team

Ok, will do, see DAO should allow to remove stale data object settings via method call · Issue #4326 · pkp/pkp-lib · GitHub