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

pkp

#1

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


#2

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


#3

Hi @asmecher

the issue basically appears when https://github.com/pkp/pkp-lib/issues/4031 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 https://github.com/pkp/pkp-lib/issues/4031). 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


#4

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


#5

Ok, will do, see https://github.com/pkp/pkp-lib/issues/4326