Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » onAfterWrite?

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 5058 Views
  • vstrazz
    Avatar
    Community Member
    63 Posts

    Re: onAfterWrite? Link to this post

    I seem to be having the same issue with OnBeforeWrite. Still no conclusion?

  • UncleCheese
    Avatar
    4085 Posts

    Re: onAfterWrite? Link to this post

    No.. I ended up taking a different route. I'd really like an answer as to why these functions get run so many times. I really screws things up for me.

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: onAfterWrite? Link to this post

    Just a thought, don't have time to test right now, but does this only happen on SiteTree objects (ie VERSIONED?).

    I wonder if versioned is causing onBeforeWrite to happen multiple times as they're written to different stages.

    Would be easy to test - if it happens to a page, but not a standard dataobject, it would would probably be the cause. Then extend the data object with versioned and see what happens.

  • UncleCheese
    Avatar
    4085 Posts

    Re: onAfterWrite? Link to this post

    I have a strong feeling that onBeforeWrite and onAfterWrite run once for every object relation. My class had two has_ones and a has_many, and I believe i was getting 4 writes. One for the main table and 3 for the relations... ??

    5058 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.