We have moved to GitHub Issues
You are viewing the read-only archive of Umbraco's issue tracker. To create new issues, please head over to GitHub Issues.
Make sure to read the blog posts announcing the move for more information.
Created by Richard Soeteman 02 Dec 2013, 13:07:17 Updated by Shannon Deminick 21 Jun 2017, 07:58:45
The event handler Media.BeforeMoveToTrash is not fired in Umbraco v7, below an example that works in V4/V6 but not in V7
///
/// <summary>
/// Clears the mediarelation table after a user moved the item to trash.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="umbraco.cms.businesslogic.MoveToTrashEventArgs"/> instance containing the event data.</param>
public void Media_BeforeMoveToTrash(Media sender, umbraco.cms.businesslogic.MoveToTrashEventArgs e)
{
var nodes = DataHelper.GetNodeAndChildren(sender.Id);
foreach (var nodeInfo in nodes)
{
MediaRelation.Delete(nodeInfo.NodeId);
}
}
This is correct, it will no longer fire just like the rest of the media/content/members events because the API controllers are using the new Services API layer which will only fire the Services API layer events.
The v7 upgrade document discusses this: http://our.umbraco.org/documentation/Installation/Upgrading/v7-upgrade#Events
If you continue to use the legacy business logic APIs in your code, then the legacy events will continue to fire (which will in turn fire the new Services Layer API events) but if you are using the new Services API layer, then only the new events will fire. This is the same with v6, the only difference is that in v7 we are using the new Services API in our codebase - eventually all of the core codebase will be using the new Services APIs.
Ah ok, I am using the legacy API but the tree is not of course.
Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/
Priority: Normal
Type: Bug
State: Closed
Assignee:
Difficulty: Normal
Category:
Backwards Compatible: True
Fix Submitted:
Affected versions: 7.0.0
Due in version:
Sprint:
Story Points:
Cycle: