Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • dig_nz 11 posts 60 karma points
    Aug 08, 2014 @ 11:46
    dig_nz
    0

    Publish related events inUmbraco 7

    Hi there,

    I am using Umbraco 7 and I need to have an additional secondary database, outside of Umbraco, that only contains published data (for some of the documentTypes).

    Therefore, I do need to update the secondary db using events. Would you know which events I should use in order to make sure that the secondary db is up to date with published content?

    Obviously I will need to use:

     Umbraco.Core.Services.ContentService.Published
     Umbraco.Core.Services.ContentService.UnPublished 
    

    But would I need to use these events too?

     Umbraco.Core.Services.ContentService.Deleted 
     Umbraco.Core.Services.ContentService.DeletedVersions 
     Umbraco.Core.Services.ContentService.RolledBack 
    

    Or any other events?

    Many thanks

  • Phillip Robinson 6 posts 26 karma points
    Aug 08, 2014 @ 11:57
    Phillip Robinson
    0

    Hi,

    Depending on what information you are saving in your secondary database you may also want to use this event

    Umbraco.Core.Services.ContentService.Trashed
    

    Which is the event called when you delete a page and it is sent to the recycle bin.

    If you are saving information about where the page is saved in the tree also consider

    Umbraco.Core.Services.ContentService.Moved
    

    Phil

  • dig_nz 11 posts 60 karma points
    Aug 08, 2014 @ 12:12
    dig_nz
    0

    Hi there,

    I am actually creating documentTypes to hold the data model, so it would be non-page related data that I would need to save into the secondary database.

    For example, I will have a documentType called Person to hold person's data, and I would need to save into the secondary db data like FirstName, LastName, Age etc. Generally it would be data from the generic properties, rather than built in documentType/page properties.

    In this occasion, what are are the events that I should be using?

    Out of the ones I mentioned in my first post, would I need to use all of them?

    And would I also need

    Umbraco.Core.Services.ContentService.Trashed
    

    I assume Umbraco.Core.Services.ContentService.Moved won't be necessary

    Many thanks!

  • Phillip Robinson 6 posts 26 karma points
    Aug 08, 2014 @ 12:49
    Phillip Robinson
    0

    Hi,

    You will need to use the Umbraco.Core.Services.ContentService.Trashed event because the Umbraco.Core.Services.ContentService.Unpublished event is not called when a user sends a page to the recycle bin even though after a user sends the page to the recycle bin the page is unpublished.

    Phil

  • dig_nz 11 posts 60 karma points
    Aug 08, 2014 @ 12:55
    dig_nz
    0

    Great, thank you.

    Would I also need:

     Umbraco.Core.Services.ContentService.Deleted 
     Umbraco.Core.Services.ContentService.DeletedVersions 
     Umbraco.Core.Services.ContentService.RolledBack 
    

    Or just Publish, Unpublish and Trash?

    Thanks!

  • Phillip Robinson 6 posts 26 karma points
    Aug 11, 2014 @ 13:16
    Phillip Robinson
    0

    Hi,

    You wont need to use the delete because the time the page actually gets unpublished is when its sent to the trash. So the Trashed event will be the one. As for the other Events you may want to put a few breakpoints in them to see when they are called as to which ones you want to use.

    Phil

  • dig_nz 11 posts 60 karma points
    Aug 11, 2014 @ 13:25
    dig_nz
    0

    Great, thank you!

  • Kieran Harvey 22 posts 55 karma points
    Jul 02, 2015 @ 01:26
    Kieran Harvey
    0

    Is there an events life-cycle document, preferably with pretty pictures?

  • Kieran Harvey 22 posts 55 karma points
    Jul 09, 2015 @ 01:30
Please Sign in or register to post replies

Write your reply to:

Draft