Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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


Go to End

12 Posts   6116 Views


Community Member, 63 Posts

24 September 2008 at 2:35am

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


Forum Moderator, 4102 Posts

24 September 2008 at 2:43am

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.


Community Member, 712 Posts

24 September 2008 at 5:02pm

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.


Forum Moderator, 4102 Posts

25 September 2008 at 1:22am

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... ??

Go to Top