Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Detecting DataList Type

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

Page: 1
Go to End
Author Topic: 247 Views
  • codepattern
    Community Member
    8 Posts

    Detecting DataList Type Link to this post

    This is probably some thing fairly easy but I can't wrap my mind around it. I am trying to put some condition based on whether a datalist is a HasManyList ot ManyManyList. For example, my debug output has ...


    ClassName =


    Created =

    2014-01-22 00:39:28


    How do I figure out if the list is a ManyManyList or a HasManyList such as

    if(ManyManyList) ...

    elseif (HasManyList) ...

    Thanks in advance

  • simon_w
    Forum Moderator
    473 Posts

    Re: Detecting DataList Type Link to this post

    if ($list instanceof ManyManyList) {

    } else if($list instanceof HasManyList) {


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.