Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » newClassInstance on CMS change

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

Page: 1
Go to End
Author Topic: 183 Views
  • zenmonkey
    Avatar
    Community Member
    527 Posts

    newClassInstance on CMS change Link to this post

    I have a page object that has a Enum Field with two slections Sold/For Sale. This field corresponds with a two Page Types MyPage and SoldMyPage. When it's changed I'd like to function much like the Page Type dropdown.

    If I call newClassInstance and a write function in onBeforeWrite, won't that cause a loop? In this case since the SoldMyPage is just a direct copy of MyPage, would it be OK to just call change the tyoe using $this->ClassName = SoldMyPage in the onBeforeWrite?

    183 Views
Page: 1
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.