Jump to:

3428 Posts in 1056 Topics by 733 members

Data Model Questions

SilverStripe Forums » Data Model Questions » How to stop Silverstripe SearchContext from throwing Version Table_Live error

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

Page: 1
Go to End
Author Topic: 246 Views
  • Lamin Barrow
    Avatar
    Community Member
    21 Posts

    How to stop Silverstripe SearchContext from throwing Version Table_Live error Link to this post

    Consider the following Silverstripe page class

    class Page extends SiteTree{

    static $has_many = array('OtherDataObjects' => 'DataObjectClass');

    public function getSearchContext() {

    $fields = new FieldSet(

    new TextField('Title', 'Tour'),
    new DropdownField('OtherDataObjects', 'Other Data Object', array('data', 'value')
    );

    $filters = array(
    'Title' => new PartialMatchFilter('Title'),
    'OtherDataObjects' => new PartialMatchFilter('OtherDataObjects.Title')
    );
    return new SearchContext(
    'Page',
    $fields,
    $filters
    );
    }

    Adding this search form to a front-end form and posting a search form always results in a [User Error] with a SQL error containing something like this at the end.

    AND ("DataObjectClass_Live"."DataObjectClass_Live" LIKE 'title') ORDER BY "Sort" LIMIT 25 OFFSET 0 Table 'database DataObjectClass_Live' doesn't exist

    I always get this error when search for items based on the has_many or many_many object relations. I get the same error in SIlverstripe versions 2.4.x and the latest 3.0.x versions.

    Any help or pointers will be appreciated.

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