Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » ManyManyComplexTableField produced field list is ambiguous error

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

Page: 1
Go to End
Author Topic: 1281 Views
  • teejay
    Avatar
    Community Member
    63 Posts

    ManyManyComplexTableField produced field list is ambiguous error Link to this post

    Hi folks,

    I have got a wierd issue with a many_many relation. I have 2 Pages a ProjectHolder and a ServicePage. The ProjectHolder page has many_many relation the ServicePage. When I add the field to the CMSFields it will come up with a nice annoying error.

    ...... CASE WHEN "SiteTree"."ClassName" IS NOT NULL THEN "SiteTree"."ClassName" ELSE 'SiteTree' END ORDER BY "Sort" LIMIT 10 OFFSET 0 Column 'ProjectHolderID' in field list is ambiguous

    here is my Projectholder

    class ProjectHolder extends Page {
       
       public static $many_many = array(
          'Services'=>'ServicePage'
       );
       
       
       function getCMSFields() {
          $fields = parent::getCMSFields();
          
          $tablefield = new ManyManyComplexTableField(
           $this,
           'Services',
           'ServicePage',
           null,
             'getCMSFields_forPopup'
          );
        $fields->addFieldToTab("Root.Content.Services",$tablefield);   
       return $fields;
       }
    }


    and here is my ServicePage

    class ServicePage extends Page {
       
       static $belongs_many_many = array(
    'ProjectHolders' => 'ProjectHolder'
       );
       
    }

    Does anyone have an idea as to what the issue could be ? Thx

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