-
Notifications
You must be signed in to change notification settings - Fork 71
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
Bug? hook_media_update(), $parent->save(), generates EmitMediaEvent for a Node #2069
Comments
Hey @antbrown did the following and couldn't reproduce: <?php
use Drupal\media\MediaInterface;
/**
* Implements hook_media_update().
*/
function mymodule_media_update(MediaInterface $media) {
$parent = \Drupal::service('islandora.utils')->getParentNode($media);
$parent->set('title', 'test');
$parent->save();
} My parent node returned from the utils call gets its title updated. Any further information as to what's triggering / a bigger stacktrace? My method of testing was: |
Hi @jordandukart, thanks for the quick turnaround. I'll try get some more data for you later today. Out of interest, when you tested did you use islandora 2.x or #cb52ddd? Cheers, Ant. |
I'm running off of |
Hey @antbrown any progress / updates on this? |
Hi @antbrown and @jordandukart, I got the same error when trying to migrate objects from Islandora 7 to Islandora 8. The code changes and issues are described here: These changes result in firing less events, but I think only the right events fire now. I will test this change on our development server, but please review and test this as well. NB: these changes might also solve another bug (that was already solved another way): #1848 regards, |
@lucasvanschaik, would you be willing to issue a pull request with the specific changes? |
I have tested some more and noticed that the above fix did not fully solve the problem. I've dug deeper and found another issue and solution. |
Think we may be able to close this with Islandora/islandora#931 and Islandora/islandora#932 being merged. |
Steps to reproduce.
$islandora = \Drupal::service('islandora.utils'); $parent = $islandora->getParentNode($media);
$parent->save();
Big note: This occurs on #cb52ddd, I need to update to 2.x before confirming it exists there as well, but this will take me a couple of days based on current workload. If anyone is able to do it faster, or knows if EmitEvent/EmitMediaEvent has addressed this issue since then, it would be much appreciated.
Further observations:
$entity
is the$parent
above. Being aNode
object, it can't find the source field name for the bundle.$parent
.If anyone knows this part of the system and could point me in the right direction, that would be awesome.
Cheers,
Ant
The text was updated successfully, but these errors were encountered: