I need to run a bulk operation that prepares a large number of entities and then does one operation across the whole set (it's to do with simplenews and has it's own batching process)
The way I would normally do with is by writing some logic into the finish handler of the batch operation, however, when writing a VBO Handler there is no way for me to inject logic into the finish method.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1926788-1.patch | 5.45 KB | rlmumford |
| #3 | interdiff.txt | 3.71 KB | rlmumford |
| #3 | 1926788-3.patch | 6 KB | rlmumford |
| #4 | 1926788-4.patch | 6.19 KB | rlmumford |
| #8 | 1926788-8.patch | 6.37 KB | andrewbelcher |
Comments
Comment #1
rlmumfordComment #2
andrewbelcher commentedMostly look good to me, do you want to provide an explanation of what you've done and what API changes it involves to help verify what you've written does what you want?
Also, I would imagine passing through the
$successvariable intoViewsBulkOperationsBaseOperation::finish()would be helpful so that the finish function can take status into consideration.As we have type hinting for
$context, it would make sense to have it for$vbo_sandboxas well for consistency.Is it worth mentioning that it also gets passed to the
finish()method, as that may well be the more common usage and is certainly yours...Comment #3
rlmumfordHere's the changes andrewbelcher suggested. Also added some improvements to the docs.
Comment #4
rlmumfordThis patch fixes some problems with the direct execution stuff.
Comment #5
douggreen commentedShouldn't there also be a change to allow hook_action_info() to define the finish function?
Comment #6
bojanz commentedI consider it bad DX to have to override the operation plugin every time I want to execute some code after a set of entities.
Let's make it a callback defined by hook_action_info() like #5 suggests.
Comment #7
slurpee commentedHello from Drupal's GSoC 2014 team. Google Summer of Code (GSoC)? - an annual program for university students organized by Google with projects managed by open source organization mentors such as us (Drupal!).
We're currently browsing the issue queue looking for projects. Do you think this issue/project is worth a student spending a summer on it and being paid by Google? If so, are you interested in mentoring the student? Learn more about Summer of Code and how to get involved at links below. We're submitting our Summer of Code application to Google in just over 24 hours and looking for last minute ideas. Please respond quickly if you're interested.
Group to join - https://groups.drupal.org/google-summer-code
Ideas for projects for Summer of Code 2014 - https://groups.drupal.org/node/404778
GSoC Homepage http://www.google-melange.com/gsoc/homepage/google/gsoc2014
Google's Summer of Code 2014 Announcement - http://google-opensource.blogspot.com/2014/02/mentoring-organization-app...
Comment #8
andrewbelcher commentedHere is the patch re-rolled... I've not addressed the issue raised in #5. However, I'm not sure I agree with it, as this is allowing the operations themselves to do things. I wonder if that is really a separate issue that may be best solved with a rules event or similar?
Comment #9
rlmumfordThis patch seems to cause problems when en-queuing large sets of results.