Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Uncaught Exception: Unable to traverse to related object field

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

Page: 1
Go to End
Author Topic: 678 Views
  • ScottT
    Avatar
    Community Member
    9 Posts

    Uncaught Exception: Unable to traverse to related object field Link to this post

    Hi Folks,
    I have the class below and am getting the error in the title. I have read other posts about this, but the problem does not seem related to the $searchable_fields array as you can see from the code:

    The full error is

    Error at sapphire/core/model/DataObject.php line 2492: Uncaught Exception: Unable to traverse to related object field [CDSEquivalent] on [SiennaEmploymentStatusCategory

    class SiennaEducationalStatusCategory extends SiennaViewableData { //which extends DataObject
       
       public static $db = array (
             'EducationalStatusCategory' => 'Varchar(255)',
             'EducationalStatusCategoryDetails' => 'HTMLText',
             
             );
       
       public static $has_one = array (
             'CDSEquivalent' => 'SiennaCDSCategory',
             );
       
       //public static $has_many = array (
       //      'EducationalStatusRecords' => 'SiennaEducationalStatus',
       //      );
       
       public static $searchable_fields = array (
             'ID',
             'EducationalStatusCategory',
             'EducationalStatusCategoryDetails'
             );
       
       public static $summary_fields = array (
             'ID',
             'EducationalStatusCategory',
             'EducationalStatusCategoryDetails',
             );
       
       public static $singular_name = 'Education Status Category';
    }

    Please help!!

  • ScottT
    Avatar
    Community Member
    9 Posts

    Re: Uncaught Exception: Unable to traverse to related object field Link to this post

    Never mind. I was not reading the error messages closely enough. The error was the same as has been posted about before.

    The comments to DataObject (line 2492) also explain the correct syntax if you with to include a $has_one field in a $searchable_fields array.

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