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

🎁 Switch transaction to listener #909

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions app/jobs/bulkrax/create_relationships_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,8 @@ def add_to_valkyrie_work(child_record, parent_record)
return true if parent_record.member_ids.include?(child_record.id)

parent_record.member_ids << child_record.id

# TODO: Hyrax is in the process of extracting an "Action" object that we could call. It does
# provide validation that we may want to consider.
#
# NOTE: We may need to look at the step args we're passing, see
# `Hyrax::WorksControllerBehavior#update_valkyrie_work`
# Hyrax's `./app/controllers/concerns/hyrax/works_controller_behavior.rb`
#
change_set = Hyrax::ChangeSet.for(parent_record)
Hyrax::Transactions::Container['change_set.update_work'].call(change_set)
Hyrax.persister.save(resource: parent_record)
Hyrax.publisher.publish('object.membership.updated', object: parent_record)
end

def add_to_af_work(child_record, parent_record)
Expand Down
Loading