Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

Search in custom DataObjects and related tables


Go to End


1131 Views

Avatar
Chimera

Community Member, 10 Posts

17 May 2013 at 10:38pm

Hi,

i have databese of proterties and its related attributes. I want to search in that database but i cant find proper solution. I want use fulltext search as is described in tutorial but divide it into two sections, one for pages, news and so on and the other for properties. My object structure is following. Can someone help me how to solve this ? Thanks for advices.


class Property extends DataObject {

    static $db = array(
        'changed' => 'SS_Datetime',
        'template_id' => 'Int',
        'user_id' => 'Int'
         .....
    );

    static $has_many = array(
        'Attributes' => 'PropertyAttribute'
    );

     .......

}

class PropertyAttribute extends DataObject {

    static $db = array(
        'name' => 'varchar',
        'value' => 'text'
    );
    static $has_one = array(
        'Property' => 'Property'
    );

}

class PropertyHolder extends Page{
    ...
}

class PropertyHolder_Controller extends Page_Controller {
   ...
}